You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2025/01/17 20:48:58 UTC

(superset) branch fix-cache-key-reflection created (now 15a1ff2041)

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

beto pushed a change to branch fix-cache-key-reflection
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 15a1ff2041 fix: add catalog to cache key when getting tables/views

This branch includes the following new commits:

     new 15a1ff2041 fix: add catalog to cache key when getting tables/views

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: add catalog to cache key when getting tables/views

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

beto pushed a commit to branch fix-cache-key-reflection
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 15a1ff2041e24d0ed92e2f079746789ffdf1fe86
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Fri Jan 17 15:48:46 2025 -0500

    fix: add catalog to cache key when getting tables/views
---
 superset/models/core.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/superset/models/core.py b/superset/models/core.py
index f71e5c5b63..ab732660fb 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -122,7 +122,9 @@ class ConfigurationMethod(StrEnum):
     DYNAMIC_FORM = "dynamic_form"
 
 
-class Database(Model, AuditMixinNullable, ImportExportMixin):  # pylint: disable=too-many-public-methods
+class Database(
+    Model, AuditMixinNullable, ImportExportMixin
+):  # pylint: disable=too-many-public-methods
     """An ORM object that stores Database related information"""
 
     __tablename__ = "dbs"
@@ -397,9 +399,7 @@ class Database(Model, AuditMixinNullable, ImportExportMixin):  # pylint: disable
         return (
             username
             if (username := get_username())
-            else object_url.username
-            if self.impersonate_user
-            else None
+            else object_url.username if self.impersonate_user else None
         )
 
     @contextmanager
@@ -791,7 +791,7 @@ class Database(Model, AuditMixinNullable, ImportExportMixin):  # pylint: disable
         return self.sqlalchemy_uri
 
     @cache_util.memoized_func(
-        key="db:{self.id}:schema:{schema}:table_list",
+        key="db:{self.id}:catalog:{catalog}:schema:{schema}:table_list",
         cache=cache_manager.cache,
     )
     def get_all_table_names_in_schema(
@@ -825,7 +825,7 @@ class Database(Model, AuditMixinNullable, ImportExportMixin):  # pylint: disable
             raise self.db_engine_spec.get_dbapi_mapped_exception(ex) from ex
 
     @cache_util.memoized_func(
-        key="db:{self.id}:schema:{schema}:view_list",
+        key="db:{self.id}:catalog:{catalog}:schema:{schema}:view_list",
         cache=cache_manager.cache,
     )
     def get_all_view_names_in_schema(