rusackas commented on code in PR #41714:
URL: https://github.com/apache/superset/pull/41714#discussion_r3699714261


##########
superset/migrations/shared/migrate_viz/base.py:
##########
@@ -185,14 +204,25 @@ def upgrade_slice(cls, slc: Slice) -> None:
     def downgrade_slice(cls, slc: Slice) -> None:
         try:
             form_data = try_load_json(slc.params)
-            if "viz_type" in (
-                form_data_bak := form_data.get(FORM_DATA_BAK_FIELD_NAME, {})
+            form_data_bak = form_data.get(FORM_DATA_BAK_FIELD_NAME, {})
+            if (
+                "viz_type" in form_data_bak
+                and form_data_bak["viz_type"] == cls.source_viz_type
             ):
                 slc.params = json.dumps(form_data_bak)
                 slc.viz_type = form_data_bak.get("viz_type")
                 query_context = try_load_json(slc.query_context)
                 queries_bak = form_data.get(QUERIES_BAK_FIELD_NAME, {})
-                if queries_bak:
+                if (
+                    isinstance(queries_bak, dict)
+                    and FULL_CONTEXT_BAK_KEY in queries_bak
+                ):
+                    # The original context had no "queries" key, so it was
+                    # backed up wholesale on upgrade -- restore it verbatim
+                    # rather than patching "queries" onto the upgraded
+                    # context.
+                    slc.query_context = 
json.dumps(queries_bak[FULL_CONTEXT_BAK_KEY])

Review Comment:
   Good catch, this one wasn't covered by the earlier fix. Pushed one now, an 
empty `queries: []` backup is distinguished from no backup at all, so it 
doesn't get discarded on downgrade.



##########
UPDATING.md:
##########
@@ -233,6 +233,10 @@ are the intended model going forward; deprecating and 
removing implicit viewersh
 in a later major version.
 
 - [41044](https://github.com/apache/superset/issues/41044): Removes the 
deprecated `AVOID_COLORS_COLLISION` feature flag (it defaulted to `True`). 
Color-collision avoidance is now permanently enabled; any config override 
setting it to `False` is ignored.
+- [41714](https://github.com/apache/superset/pull/41714): **Breaking — the 
legacy `explore_json` chart-data pipeline is removed** at its long-declared 
`5.0.0` EOL. The `/superset/explore_json/` and 
`/superset/explore_json/data/<cache_key>` endpoints, `superset/viz.py`, the 
`Slice.viz` property, the `get_viz` factory, the `load_explore_json_into_cache` 
celery task and the `viz=` overload of `security_manager.raise_for_access` are 
gone. Anything importing `superset.viz` must migrate to the QueryContext / 
`pandas_postprocessing` pipeline behind `/api/v1/chart/data`. All 15 remaining 
legacy charts were migrated first: most keep their `viz_type` and renderer (no 
action needed for saved charts), while saved nvd3 Bubble charts are 
auto-migrated to the ECharts Bubble Chart (`bubble_v2`) and saved "Time-series 
Percent Change" (`compare`) charts to the ECharts Line Chart — the nvd3 
renderer's interactive percent re-basing is not preserved. The deck.gl Multiple 
Layers chart now fetches its
  layers entirely client-side; its initial autozoom falls back to the saved 
viewport, and dashboard filter badges no longer aggregate child-layer filter 
metadata.

Review Comment:
   Fixed, updated to reflect that both limitations were resolved earlier in the 
branch.



-- 
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