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


##########
superset/db_engine_specs/base.py:
##########
@@ -472,7 +472,10 @@ def get_engine(
         schema: Optional[str] = None,
         source: Optional[utils.QuerySource] = None,
     ) -> Engine:
-        return database.get_sqla_engine(schema=schema, source=source)
+        with database.get_sqla_engine_with_context(
+            schema=schema, source=source
+        ) as engine:
+            return engine

Review Comment:
   This won't work; before returning the context manager will be exited before 
the functions returns. It's equivalent to:
   
   ```python
   with database.get_sqla_engine_with_context(...) as engine:
       a = engine
   return a
   ```



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