You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2026/03/20 19:43:12 UTC

(superset) 11/32: fix(dashboard): overload issue in dashboard export to excel (#29418)

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

michaelsmolina pushed a commit to branch 6.1
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 54b313c6592efe7799b395f421f4b1baffc3d5de
Author: mcdogg17 <63...@users.noreply.github.com>
AuthorDate: Tue Mar 17 21:29:32 2026 +0500

    fix(dashboard): overload issue in dashboard export to excel (#29418)
    
    Co-authored-by: Evan Rusackas <ev...@preset.io>
    Co-authored-by: Claude <cl...@anthropic.com>
    Co-authored-by: Claude Sonnet 4.6 <no...@anthropic.com>
---
 superset/common/query_context_factory.py | 5 ++++-
 superset/models/slice.py                 | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/superset/common/query_context_factory.py b/superset/common/query_context_factory.py
index a60eac43848..0d1539a9a16 100644
--- a/superset/common/query_context_factory.py
+++ b/superset/common/query_context_factory.py
@@ -45,6 +45,7 @@ class QueryContextFactory:  # pylint: disable=too-few-public-methods
     def create(  # pylint: disable=too-many-arguments
         self,
         *,
+        current_slice: Slice | None = None,
         datasource: DatasourceDict,
         queries: list[dict[str, Any]],
         form_data: dict[str, Any] | None = None,
@@ -58,7 +59,9 @@ class QueryContextFactory:  # pylint: disable=too-few-public-methods
             datasource_model_instance = self._convert_to_model(datasource)
 
         slice_ = None
-        if form_data and form_data.get("slice_id") is not None:
+        if isinstance(current_slice, Slice):
+            slice_ = current_slice
+        elif form_data and form_data.get("slice_id") is not None:
             slice_ = self._get_slice(form_data.get("slice_id"))
 
         result_type = result_type or ChartDataResultType.FULL
diff --git a/superset/models/slice.py b/superset/models/slice.py
index 5fce86d79e2..8b864f4ddc2 100644
--- a/superset/models/slice.py
+++ b/superset/models/slice.py
@@ -274,7 +274,7 @@ class Slice(  # pylint: disable=too-many-public-methods
         if self.query_context:
             try:
                 return self.get_query_context_factory().create(
-                    **json.loads(self.query_context)
+                    **{**json.loads(self.query_context), "current_slice": self}
                 )
             except json.JSONDecodeError as ex:
                 logger.error("Malformed json in slice's query context", exc_info=True)