Skip to content

Commit a4d8f36

Browse files
fix: chart import (#25425)
1 parent 40ba3c2 commit a4d8f36

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

superset/charts/commands/importers/v1/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def migrate_chart(config: dict[str, Any]) -> dict[str, Any]:
9999

100100
# also update `query_context`
101101
try:
102-
query_context = json.loads(output.get("query_context", "{}"))
103-
except json.decoder.JSONDecodeError:
102+
query_context = json.loads(output.get("query_context") or "{}")
103+
except (json.decoder.JSONDecodeError, TypeError):
104104
query_context = {}
105105
if "form_data" in query_context:
106106
query_context["form_data"] = output["params"]

tests/unit_tests/charts/commands/importers/v1/utils_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_migrate_chart_area() -> None:
3232
"certified_by": None,
3333
"certification_details": None,
3434
"viz_type": "area",
35+
"query_context": None,
3536
"params": json.dumps(
3637
{
3738
"adhoc_filters": [],

0 commit comments

Comments
 (0)