From fcf6fe280b1aa6bb2880ad36637ad322476a0cb3 Mon Sep 17 00:00:00 2001 From: ncclementi Date: Tue, 27 Aug 2024 17:41:20 -0400 Subject: [PATCH] chore: use sqlglot in test_temp_view --- ibis/backends/tests/test_api.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ibis/backends/tests/test_api.py b/ibis/backends/tests/test_api.py index 17dfc967308c2..8d93eca617ce0 100644 --- a/ibis/backends/tests/test_api.py +++ b/ibis/backends/tests/test_api.py @@ -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 @@ -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)