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/07 22:36:16 UTC
[superset] 01/03: save
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch refactor-tc
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 32bdefef6827c0d11e4bf572368bf57d913606bc
Author: hughhhh <hu...@gmail.com>
AuthorDate: Wed Dec 7 12:35:53 2022 -0500
save
---
superset/models/core.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/superset/models/core.py b/superset/models/core.py
index 4efcf311c6..623e76a074 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -423,7 +423,19 @@ class Database(
return create_engine(sqlalchemy_url, **params)
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,
+ **kwargs,
+ ) -> Connection:
+ with self.get_sqla_engine_with_context(**kwargs) 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"""