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 2023/01/03 22:58:38 UTC

[superset] branch fix-dataset-modal-ssh-tunnel created (now 66f68afe4c)

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

hugh pushed a change to branch fix-dataset-modal-ssh-tunnel
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 66f68afe4c fix internal functions

This branch includes the following new commits:

     new 66f68afe4c fix internal functions

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/01: fix internal functions

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch fix-dataset-modal-ssh-tunnel
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 66f68afe4c3d4adf48154f47f45f004f310fa4d6
Author: hughhhh <hu...@gmail.com>
AuthorDate: Tue Jan 3 17:57:01 2023 -0500

    fix internal functions
---
 superset/models/core.py | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/superset/models/core.py b/superset/models/core.py
index 173bd5b590..9e042eeab5 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -744,13 +744,14 @@ class Database(
     def get_table(self, table_name: str, schema: Optional[str] = None) -> Table:
         extra = self.get_extra()
         meta = MetaData(**extra.get("metadata_params", {}))
-        return Table(
-            table_name,
-            meta,
-            schema=schema or None,
-            autoload=True,
-            autoload_with=self._get_sqla_engine(),
-        )
+        with self.get_sqla_engine_with_context() as engine:
+            return Table(
+                table_name,
+                meta,
+                schema=schema or None,
+                autoload=True,
+                autoload_with=engine,
+            )
 
     def get_table_comment(
         self, table_name: str, schema: Optional[str] = None
@@ -846,12 +847,12 @@ class Database(
         return self.perm  # type: ignore
 
     def has_table(self, table: Table) -> bool:
-        engine = self._get_sqla_engine()
-        return engine.has_table(table.table_name, table.schema or None)
+        with self.get_sqla_engine_with_context() as engine:
+            return engine.has_table(table.table_name, table.schema or None)
 
     def has_table_by_name(self, table_name: str, schema: Optional[str] = None) -> bool:
-        engine = self._get_sqla_engine()
-        return engine.has_table(table_name, schema)
+        with self.get_sqla_engine_with_context() as engine:
+            return engine.has_table(table_name, schema)
 
     @classmethod
     def _has_view(