michael-s-molina commented on code in PR #33285:
URL: https://github.com/apache/superset/pull/33285#discussion_r2107607318


##########
superset/migrations/shared/migrate_viz/base.py:
##########
@@ -136,14 +137,29 @@ def upgrade_slice(cls, slc: Slice) -> None:
             # because a source viz can be mapped to different target viz types
             slc.viz_type = clz.target_viz_type
 
-            # only backup params
-            slc.params = json.dumps(
-                {**clz.data, FORM_DATA_BAK_FIELD_NAME: form_data_bak}
-            )
+            backup = {FORM_DATA_BAK_FIELD_NAME: form_data_bak}
+
+            query_context = try_load_json(slc.query_context)
+
+            if query_context:
+                if "form_data" in query_context:
+                    query_context["form_data"] = clz.data
+
+                queries_bak = copy.deepcopy(query_context["queries"])
+
+                result = clz._build_query()
+                queries = result["queries"]

Review Comment:
   ```suggestion
                   queries = clz._build_query()["queries"]
   ```



##########
superset/migrations/shared/migrate_viz/base.py:
##########
@@ -136,14 +137,29 @@ def upgrade_slice(cls, slc: Slice) -> None:
             # because a source viz can be mapped to different target viz types
             slc.viz_type = clz.target_viz_type
 
-            # only backup params
-            slc.params = json.dumps(
-                {**clz.data, FORM_DATA_BAK_FIELD_NAME: form_data_bak}
-            )
+            backup = {FORM_DATA_BAK_FIELD_NAME: form_data_bak}
+
+            query_context = try_load_json(slc.query_context)
+
+            if query_context:
+                if "form_data" in query_context:
+                    query_context["form_data"] = clz.data
+
+                queries_bak = copy.deepcopy(query_context["queries"])
+
+                result = clz._build_query()
+                queries = result["queries"]
+                query_context["queries"] = queries
+
+                slc.query_context = json.dumps(
+                    {
+                        **query_context,
+                    }
+                )

Review Comment:
   ```suggestion
                   slc.query_context = json.dumps(query_context)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to