You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2023/09/26 23:53:59 UTC

[superset] branch fix_import created (now 65f0178490)

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

beto pushed a change to branch fix_import
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 65f0178490 fix: chart import

This branch includes the following new commits:

     new 65f0178490 fix: chart import

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/01: fix: chart import

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 65f0178490e2b7d0cdf1fdb1138f985e5b299042
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Tue Sep 26 16:52:19 2023 -0700

    fix: chart import
---
 superset/charts/commands/importers/v1/utils.py              | 4 ++--
 tests/unit_tests/charts/commands/importers/v1/utils_test.py | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/superset/charts/commands/importers/v1/utils.py b/superset/charts/commands/importers/v1/utils.py
index d3f90f7ff4..3ef0a2ed78 100644
--- a/superset/charts/commands/importers/v1/utils.py
+++ b/superset/charts/commands/importers/v1/utils.py
@@ -99,8 +99,8 @@ def migrate_chart(config: dict[str, Any]) -> dict[str, Any]:
 
     # also update `query_context`
     try:
-        query_context = json.loads(output.get("query_context", "{}"))
-    except json.decoder.JSONDecodeError:
+        query_context = json.loads(output.get("query_context") or "{}")
+    except (json.decoder.JSONDecodeError, TypeError):
         query_context = {}
     if "form_data" in query_context:
         query_context["form_data"] = output["params"]
diff --git a/tests/unit_tests/charts/commands/importers/v1/utils_test.py b/tests/unit_tests/charts/commands/importers/v1/utils_test.py
index c99ecaf6d6..77d31e7d77 100644
--- a/tests/unit_tests/charts/commands/importers/v1/utils_test.py
+++ b/tests/unit_tests/charts/commands/importers/v1/utils_test.py
@@ -32,6 +32,7 @@ def test_migrate_chart_area() -> None:
         "certified_by": None,
         "certification_details": None,
         "viz_type": "area",
+        "query_context": None,
         "params": json.dumps(
             {
                 "adhoc_filters": [],