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/07/18 03:29:25 UTC
(superset) 07/09: Add cache
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch dbt-metricflow
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 8432ee47d6b1c05ab25fe12b6acde09e65026612
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Thu Jul 17 22:02:08 2025 -0400
Add cache
---
superset/daos/database.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/superset/daos/database.py b/superset/daos/database.py
index d833012b0d..a69f48d564 100644
--- a/superset/daos/database.py
+++ b/superset/daos/database.py
@@ -24,7 +24,7 @@ from superset.daos.base import BaseDAO
from superset.databases.filters import DatabaseFilter
from superset.databases.ssh_tunnel.models import SSHTunnel
from superset.db_engine_specs.base import ValidColumnsType
-from superset.extensions import db
+from superset.extensions import cache_manager, db
from superset.models.core import Database, DatabaseUserOAuth2Tokens
from superset.models.dashboard import Dashboard
from superset.models.slice import Slice
@@ -168,6 +168,7 @@ class DatabaseDAO(BaseDAO[Database]):
return ssh_tunnel
@classmethod
+ @cache_manager.data_cache.memoize(timeout=86400) # 1 day cache
def get_valid_metrics_and_dimensions(
cls,
database_id: int,
@@ -177,6 +178,7 @@ class DatabaseDAO(BaseDAO[Database]):
) -> ValidColumnsType:
"""
Get valid metrics and dimensions for a datasource using the database engine spec.
+ Results are cached for 1 day to improve performance.
:param database_id: The database ID
:param datasource_id: The datasource ID