From 80dd9c2607d90ceaa6d2524893d54641c73d5ac9 Mon Sep 17 00:00:00 2001 From: Daniel Gaspar Date: Tue, 11 Jun 2024 22:09:16 +0100 Subject: [PATCH] fix tests --- tests/integration_tests/sqllab_tests.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/integration_tests/sqllab_tests.py b/tests/integration_tests/sqllab_tests.py index 3fc89c7732455..a7b51bdf029a0 100644 --- a/tests/integration_tests/sqllab_tests.py +++ b/tests/integration_tests/sqllab_tests.py @@ -304,9 +304,11 @@ def test_sql_json_schema_access(self): ) with examples_db.get_sqla_engine() as engine: - engine.execute( - f"CREATE TABLE IF NOT EXISTS {CTAS_SCHEMA_NAME}.test_table AS SELECT 1 as c1, 2 as c2" - ) + with engine.connect() as conn: + conn.execute( + text(f"CREATE TABLE IF NOT EXISTS {CTAS_SCHEMA_NAME}.test_table AS SELECT 1 as c1, 2 as c2") + ) + conn.execute(text("COMMIT")) data = self.run_sql( f"SELECT * FROM {CTAS_SCHEMA_NAME}.test_table", "3", username="SchemaUser" @@ -333,8 +335,9 @@ def test_sql_json_schema_access(self): db.session.query(Query).delete() with get_example_database().get_sqla_engine() as engine: - engine.execute(f"DROP TABLE IF EXISTS {CTAS_SCHEMA_NAME}.test_table") - db.session.commit() + with engine.connect() as conn: + conn.execute(text(f"DROP TABLE IF EXISTS {CTAS_SCHEMA_NAME}.test_table")) + conn.execute(text("COMMIT")) def test_alias_duplicate(self): self.run_sql(