Skip to content

Commit

Permalink
fix: add catalog to cache key when getting tables/views
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Jan 17, 2025
1 parent c1cbc33 commit 15a1ff2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions superset/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -397,9 +399,7 @@ def get_effective_user(self, object_url: URL) -> str | None:
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
Expand Down Expand Up @@ -791,7 +791,7 @@ def safe_sqlalchemy_uri(self) -> str:
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(
Expand Down Expand Up @@ -825,7 +825,7 @@ def get_all_table_names_in_schema(
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(
Expand Down

0 comments on commit 15a1ff2

Please sign in to comment.