You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2023/04/13 20:35:11 UTC

[superset] branch master updated: fix: url_params cache miss with global async query (#23641)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 19404bc13e fix: url_params cache miss with global async query (#23641)
19404bc13e is described below

commit 19404bc13edfa50553ffdbc4768e5528dda4e8b0
Author: Kenny Kwan <ke...@gmail.com>
AuthorDate: Thu Apr 13 13:35:02 2023 -0700

    fix: url_params cache miss with global async query (#23641)
---
 superset/charts/data/api.py | 5 ++++-
 superset/views/core.py      | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/superset/charts/data/api.py b/superset/charts/data/api.py
index 8e58440c76..e48696219a 100644
--- a/superset/charts/data/api.py
+++ b/superset/charts/data/api.py
@@ -21,7 +21,7 @@ import logging
 from typing import Any, Dict, Optional, TYPE_CHECKING, Union
 
 import simplejson
-from flask import current_app, make_response, request, Response
+from flask import current_app, g, make_response, request, Response
 from flask_appbuilder.api import expose, protect
 from flask_babel import gettext as _
 from marshmallow import ValidationError
@@ -299,6 +299,9 @@ class ChartDataRestApi(ChartRestApi):
         """
         try:
             cached_data = self._load_query_context_form_from_cache(cache_key)
+            # Set form_data in Flask Global as it is used as a fallback
+            # for async queries with jinja context
+            setattr(g, "form_data", cached_data)
             query_context = self._create_query_context_from_form(cached_data)
             command = ChartDataCommand(query_context)
             command.validate()
diff --git a/superset/views/core.py b/superset/views/core.py
index 1d9d80c5b1..72e1627331 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -583,7 +583,9 @@ class Superset(BaseSupersetView):  # pylint: disable=too-many-public-methods
 
             form_data = cached.get("form_data")
             response_type = cached.get("response_type")
-
+            # Set form_data in Flask Global as it is used as a fallback
+            # for async queries with jinja context
+            setattr(g, "form_data", form_data)
             datasource_id, datasource_type = get_datasource_info(None, None, form_data)
 
             viz_obj = get_viz(