This is an automated email from the ASF dual-hosted git repository.
elizabeth 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 a0a0d8043f fix(import): Make sure query context is overwritten for
overwriting imports (#25493)
a0a0d8043f is described below
commit a0a0d8043fe7004134bf89a05e6b5f6ee41399e5
Author: Jack Fragassi <[email protected]>
AuthorDate: Mon Oct 16 09:49:55 2023 -0700
fix(import): Make sure query context is overwritten for overwriting imports
(#25493)
---
superset/charts/commands/importers/v1/__init__.py | 2 +-
superset/commands/importers/v1/assets.py | 2 +-
superset/dashboards/commands/importers/v1/__init__.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/superset/charts/commands/importers/v1/__init__.py
b/superset/charts/commands/importers/v1/__init__.py
index 2a9c691159..043018fa3b 100644
--- a/superset/charts/commands/importers/v1/__init__.py
+++ b/superset/charts/commands/importers/v1/__init__.py
@@ -95,6 +95,6 @@ class ImportChartsCommand(ImportModelsCommand):
config["params"].update({"datasource": dataset.uid})
if "query_context" in config:
- del config["query_context"]
+ config["query_context"] = None
import_chart(session, config, overwrite=overwrite)
diff --git a/superset/commands/importers/v1/assets.py
b/superset/commands/importers/v1/assets.py
index f0720d70b1..4c8971315c 100644
--- a/superset/commands/importers/v1/assets.py
+++ b/superset/commands/importers/v1/assets.py
@@ -117,7 +117,7 @@ class ImportAssetsCommand(BaseCommand):
dataset_uid =
f"{dataset_dict['datasource_id']}__{dataset_dict['datasource_type']}"
config["params"].update({"datasource": dataset_uid})
if "query_context" in config:
- del config["query_context"]
+ config["query_context"] = None
chart = import_chart(session, config, overwrite=True)
chart_ids[str(chart.uuid)] = chart.id
diff --git a/superset/dashboards/commands/importers/v1/__init__.py
b/superset/dashboards/commands/importers/v1/__init__.py
index e86bddec9f..30e63da4e4 100644
--- a/superset/dashboards/commands/importers/v1/__init__.py
+++ b/superset/dashboards/commands/importers/v1/__init__.py
@@ -118,7 +118,7 @@ class ImportDashboardsCommand(ImportModelsCommand):
dataset_uid =
f"{dataset_dict['datasource_id']}__{dataset_dict['datasource_type']}"
config["params"].update({"datasource": dataset_uid})
if "query_context" in config:
- del config["query_context"]
+ config["query_context"] = None
chart = import_chart(session, config, overwrite=False)
chart_ids[str(chart.uuid)] = chart.id