refactor: rename get_sqla_engine_with_context (#28012)

This commit is contained in:
Beto Dealmeida
2024-04-12 13:31:05 -04:00
committed by GitHub
parent 06077d42a8
commit 99a1601aea
45 changed files with 99 additions and 100 deletions

View File

@@ -718,7 +718,7 @@ class TestDatasetApi(SupersetTestCase):
return
example_db = get_example_database()
with example_db.get_sqla_engine_with_context() as engine:
with example_db.get_sqla_engine() as engine:
engine.execute(
f"CREATE TABLE {CTAS_SCHEMA_NAME}.birth_names AS SELECT 2 as two"
)
@@ -739,7 +739,7 @@ class TestDatasetApi(SupersetTestCase):
uri = f'api/v1/dataset/{data.get("id")}'
rv = self.client.delete(uri)
assert rv.status_code == 200
with example_db.get_sqla_engine_with_context() as engine:
with example_db.get_sqla_engine() as engine:
engine.execute(f"DROP TABLE {CTAS_SCHEMA_NAME}.birth_names")
def test_create_dataset_validate_database(self):
@@ -800,7 +800,7 @@ class TestDatasetApi(SupersetTestCase):
mock_get_table.return_value = None
example_db = get_example_database()
with example_db.get_sqla_engine_with_context() as engine:
with example_db.get_sqla_engine() as engine:
engine = engine
dialect = engine.dialect
@@ -2389,7 +2389,7 @@ class TestDatasetApi(SupersetTestCase):
self.login(ADMIN_USERNAME)
examples_db = get_example_database()
with examples_db.get_sqla_engine_with_context() as engine:
with examples_db.get_sqla_engine() as engine:
engine.execute("DROP TABLE IF EXISTS test_create_sqla_table_api")
engine.execute("CREATE TABLE test_create_sqla_table_api AS SELECT 2 as col")
@@ -2415,7 +2415,7 @@ class TestDatasetApi(SupersetTestCase):
db.session.delete(table)
db.session.commit()
with examples_db.get_sqla_engine_with_context() as engine:
with examples_db.get_sqla_engine() as engine:
engine.execute("DROP TABLE test_create_sqla_table_api")
@pytest.mark.usefixtures(

View File

@@ -563,7 +563,7 @@ class TestCreateDatasetCommand(SupersetTestCase):
def test_create_dataset_command(self):
examples_db = get_example_database()
with examples_db.get_sqla_engine_with_context() as engine:
with examples_db.get_sqla_engine() as engine:
engine.execute("DROP TABLE IF EXISTS test_create_dataset_command")
engine.execute(
"CREATE TABLE test_create_dataset_command AS SELECT 2 as col"
@@ -585,7 +585,7 @@ class TestCreateDatasetCommand(SupersetTestCase):
self.assertEqual([owner.username for owner in table.owners], ["admin"])
db.session.delete(table)
with examples_db.get_sqla_engine_with_context() as engine:
with examples_db.get_sqla_engine() as engine:
engine.execute("DROP TABLE test_create_dataset_command")
db.session.commit()