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 <[email protected]>
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(

Reply via email to