hughhhh commented on code in PR #21943:
URL: https://github.com/apache/superset/pull/21943#discussion_r1021984198


##########
superset/db_engine_specs/base.py:
##########
@@ -894,17 +903,17 @@ def df_to_sql(
         :param to_sql_kwargs: The kwargs to be passed to 
pandas.DataFrame.to_sql` method
         """
 
-        engine = cls.get_engine(database)
         to_sql_kwargs["name"] = table.table
 
         if table.schema:
             # Only add schema when it is preset and non empty.
             to_sql_kwargs["schema"] = table.schema
 
-        if engine.dialect.supports_multivalues_insert:
-            to_sql_kwargs["method"] = "multi"
+        with cls.get_engine(database) as engine:
+            if engine.dialect.supports_multivalues_insert:
+                to_sql_kwargs["method"] = "multi"

Review Comment:
   in this case we still need the `engine` though, so it makes more sense to 
just use `get_engine` instead of just the dialect
   
   
https://github.com/apache/superset/pull/21943/files/7ce583678e1770d472527abb8270dd22e666b9c0#diff-2e62d64ef1113e48efdfeb2acbaa522fca13e49e6a00c2cfd4f74efc4ae1b45cR916



-- 
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]

Reply via email to