mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
feat: create function for get_sqla_engine with context (#21790)
This commit is contained in:
@@ -37,16 +37,17 @@ UNICODE_TBL_NAME = "unicode_test"
|
||||
@pytest.fixture(scope="session")
|
||||
def load_unicode_data():
|
||||
with app.app_context():
|
||||
_get_dataframe().to_sql(
|
||||
UNICODE_TBL_NAME,
|
||||
get_example_database().get_sqla_engine(),
|
||||
if_exists="replace",
|
||||
chunksize=500,
|
||||
dtype={"phrase": String(500)},
|
||||
index=False,
|
||||
method="multi",
|
||||
schema=get_example_default_schema(),
|
||||
)
|
||||
with get_example_database().get_sqla_engine_with_context() as engine:
|
||||
_get_dataframe().to_sql(
|
||||
UNICODE_TBL_NAME,
|
||||
engine,
|
||||
if_exists="replace",
|
||||
chunksize=500,
|
||||
dtype={"phrase": String(500)},
|
||||
index=False,
|
||||
method="multi",
|
||||
schema=get_example_default_schema(),
|
||||
)
|
||||
|
||||
yield
|
||||
with app.app_context():
|
||||
|
||||
Reference in New Issue
Block a user