Skip to content

Commit

Permalink
chore: use sqlglot in test_temp_view
Browse files Browse the repository at this point in the history
  • Loading branch information
ncclementi committed Aug 27, 2024
1 parent 2b5db1a commit fcf6fe2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ibis/backends/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from __future__ import annotations

import pytest
import sqlglot as sg
import sqlglot.expressions as sge
from pytest import param

import ibis.expr.types as ir
from ibis.backends.conftest import TEST_TABLES
from ibis.backends.sql.compilers.base import STAR
from ibis.backends.tests.errors import PyDruidProgrammingError


Expand Down Expand Up @@ -186,10 +189,14 @@ def test_list_temp_tables(ddl_con):

def test_list_temp_views(ddl_con):
# TODO: replace raw_sql with create_temp
ddl_con.raw_sql("""
CREATE TEMPORARY VIEW temp_view_example AS SELECT * FROM functional_alltypes
""")

temp_view = sge.Create(
this=sg.table("temp_view_example"),
kind="VIEW",
expression=sg.select(STAR).from_(sg.table("functional_alltypes")),
properties=sge.Properties(expressions=[sge.TemporaryProperty()]),
)
ddl_con.raw_sql(temp_view.sql(ddl_con.dialect))
temporary_views = ddl_con.ddl.list_temp_views()

assert isinstance(temporary_views, list)
Expand Down

0 comments on commit fcf6fe2

Please sign in to comment.