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 2023/07/20 18:25:58 UTC

[superset] branch master updated: fix(pvt2): migrations from legacy pivot table error when form_data have pieces of pvt2 (#24710)

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

michaelsmolina 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 df106aa708 fix(pvt2): migrations from legacy pivot table error when form_data have pieces of pvt2 (#24710)
df106aa708 is described below

commit df106aa708c2ad4f3ba4a2fdf59bf80f365811bd
Author: Stepan <66...@users.noreply.github.com>
AuthorDate: Thu Jul 20 21:25:51 2023 +0300

    fix(pvt2): migrations from legacy pivot table error when form_data have pieces of pvt2 (#24710)
---
 superset/migrations/shared/migrate_viz/base.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/superset/migrations/shared/migrate_viz/base.py b/superset/migrations/shared/migrate_viz/base.py
index e277fcd208..09b77ae271 100644
--- a/superset/migrations/shared/migrate_viz/base.py
+++ b/superset/migrations/shared/migrate_viz/base.py
@@ -64,6 +64,12 @@ class MigrateViz:
         if "viz_type" in self.data:
             self.data["viz_type"] = self.target_viz_type
 
+        # Sometimes visualizations have same keys in the source form_data and rename_keys
+        # We need to remove them from data to allow the migration to work properly with rename_keys
+        for source_key, target_key in self.rename_keys.items():
+            if source_key in self.data and target_key in self.data:
+                self.data.pop(target_key)
+
         rv_data = {}
         for key, value in self.data.items():
             if key in self.rename_keys and self.rename_keys[key] in rv_data: