From ef322a3b0df7d35446a60141ad98288102547a52 Mon Sep 17 00:00:00 2001 From: David Aaron Suddjian Date: Thu, 22 Apr 2021 23:42:54 -0700 Subject: [PATCH] spread the cache love --- superset/models/dashboard.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/superset/models/dashboard.py b/superset/models/dashboard.py index e1e0578dc55fc..0690a483d2363 100644 --- a/superset/models/dashboard.py +++ b/superset/models/dashboard.py @@ -164,7 +164,7 @@ def __repr__(self) -> str: @property def table_names(self) -> str: # pylint: disable=no-member - return ", ".join(str(s.datasource.full_name) for s in self.slices) + return ", ".join(str(s.datasource.full_name) for s in self.slices_cached()) @property def url(self) -> str: @@ -172,11 +172,11 @@ def url(self) -> str: @property def datasources(self) -> Set[BaseDatasource]: - return {slc.datasource for slc in self.slices} + return {slc.datasource for slc in self.slices_cached()} @property def charts(self) -> List[BaseDatasource]: - return [slc.chart for slc in self.slices] + return [slc.chart for slc in self.slices_cached()] @property def sqla_metadata(self) -> None: @@ -235,7 +235,7 @@ def data(self) -> Dict[str, Any]: "dashboard_title": self.dashboard_title, "published": self.published, "slug": self.slug, - "slices": [slc.data for slc in self.slices], + "slices": [slc.data for slc in self.slices_cached()], "position_json": positions, "last_modified_time": self.changed_on.replace(microsecond=0).timestamp(), } @@ -254,7 +254,7 @@ def slices_cached(self) -> List[Slice]: unless=lambda: not is_feature_enabled("DASHBOARD_CACHE"), ) def datasets_trimmed_for_slices(self) -> Dict[str, Any]: - datasource_slices = utils.indexed(self.slices, "datasource") + datasource_slices = utils.indexed(self.slices_cached(), "datasource") return { # Filter out unneeded fields from the datasource payload datasource.uid: datasource.data_for_slices(slices)