You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/12/27 23:08:42 UTC

[superset] 01/01: check in core.py

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch test-reafactor-tc
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 0d3a2f1b48636e4b2b5a94b533257ea74cebcedd
Author: hughhhh <hu...@gmail.com>
AuthorDate: Tue Dec 27 18:08:19 2022 -0500

    check in core.py
---
 superset/models/core.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/superset/models/core.py b/superset/models/core.py
index 1f2fa7f71c..12ce9ef95e 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -429,6 +429,19 @@ class Database(
         except Exception as ex:
             raise self.db_engine_spec.get_dbapi_mapped_exception(ex)
 
+    @contextmanager
+    def get_raw_connection(
+        self,
+        schema: Optional[str] = None,
+        nullpool: bool = True,
+        source: Optional[utils.QuerySource] = None,
+    ) -> Connection:
+        with self.get_sqla_engine_with_context(
+            schema=schema, nullpool=nullpool, source=source
+        ) as engine:
+            with closing(engine.raw_connection()) as conn:
+                yield conn
+
     @property
     def quote_identifier(self) -> Callable[[str], str]:
         """Add quotes to potential identifiter expressions if needed"""