betodealmeida commented on code in PR #21943:
URL: https://github.com/apache/superset/pull/21943#discussion_r1022105826
##########
superset/datasets/commands/importers/v1/utils.py:
##########
@@ -168,15 +168,16 @@ def load_data(
connection = session.connection()
else:
logger.warning("Loading data outside the import transaction")
- connection = database.get_sqla_engine()
-
- df.to_sql(
- dataset.table_name,
- con=connection,
- schema=dataset.schema,
- if_exists="replace",
- chunksize=CHUNKSIZE,
- dtype=dtype,
- index=False,
- method="multi",
- )
+ with database.get_sqla_engine_with_context() as engine:
+ connection = engine
+
+ df.to_sql(
Review Comment:
This will only run in the `else` block, but it needs to run in the `if
database.sqlalchemy_uri == current_app.config.get("SQLALCHEMY_DATABASE_URI"):`
block as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]