Skip to content

Commit

Permalink
add to else
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh committed Nov 14, 2022
1 parent 12b05bd commit 89020b5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions superset/datasets/commands/importers/v1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,22 @@ def load_data(
if database.sqlalchemy_uri == current_app.config.get("SQLALCHEMY_DATABASE_URI"):
logger.info("Loading data inside the import transaction")
connection = session.connection()
df.to_sql(
dataset.table_name,
con=connection,
schema=dataset.schema,
if_exists="replace",
chunksize=CHUNKSIZE,
dtype=dtype,
index=False,
method="multi",
)
else:
logger.warning("Loading data outside the import transaction")
with database.get_sqla_engine_with_context() as engine:
connection = engine

df.to_sql(
dataset.table_name,
con=connection,
con=engine,
schema=dataset.schema,
if_exists="replace",
chunksize=CHUNKSIZE,
Expand Down

0 comments on commit 89020b5

Please sign in to comment.