mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: calls to _get_sqla_engine (#24953)
This commit is contained in:
@@ -120,9 +120,8 @@ def drop_table_if_exists(table_name: str, table_type: CtasMethod) -> None:
|
||||
def quote_f(value: Optional[str]):
|
||||
if not value:
|
||||
return value
|
||||
return get_example_database().inspector.engine.dialect.identifier_preparer.quote_identifier(
|
||||
value
|
||||
)
|
||||
with get_example_database().get_inspector_with_context() as inspector:
|
||||
return inspector.engine.dialect.identifier_preparer.quote_identifier(value)
|
||||
|
||||
|
||||
def cta_result(ctas_method: CtasMethod):
|
||||
|
||||
@@ -113,9 +113,10 @@ class BaseTestChartDataApi(SupersetTestCase):
|
||||
|
||||
def quote_name(self, name: str):
|
||||
if get_main_database().backend in {"presto", "hive"}:
|
||||
return get_example_database().inspector.engine.dialect.identifier_preparer.quote_identifier(
|
||||
name
|
||||
)
|
||||
with get_example_database().get_inspector_with_context() as inspector: # E: Ne
|
||||
return inspector.engine.dialect.identifier_preparer.quote_identifier(
|
||||
name
|
||||
)
|
||||
return name
|
||||
|
||||
|
||||
|
||||
@@ -296,7 +296,8 @@ class TestDatabaseModel(SupersetTestCase):
|
||||
db = get_example_database()
|
||||
table_name = "energy_usage"
|
||||
sql = db.select_star(table_name, show_cols=False, latest_partition=False)
|
||||
quote = db.inspector.engine.dialect.identifier_preparer.quote_identifier
|
||||
with db.get_sqla_engine_with_context() as engine:
|
||||
quote = engine.dialect.identifier_preparer.quote_identifier
|
||||
expected = (
|
||||
textwrap.dedent(
|
||||
f"""\
|
||||
|
||||
Reference in New Issue
Block a user