This is an automated email from the ASF dual-hosted git repository.
beto 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 3b11654 fix: import dataset/dashboard empty keys (#13979)
3b11654 is described below
commit 3b11654c5aaa7a32d75ee1431929b667fe67ff5d
Author: Beto Dealmeida <[email protected]>
AuthorDate: Tue Apr 6 20:55:15 2021 -0700
fix: import dataset/dashboard empty keys (#13979)
---
superset/dashboards/commands/importers/v1/utils.py | 2 +-
superset/datasets/commands/importers/v1/utils.py | 2 +-
tests/datasets/commands_tests.py | 2 +-
tests/fixtures/importexport.py | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/superset/dashboards/commands/importers/v1/utils.py
b/superset/dashboards/commands/importers/v1/utils.py
index 9802767..09d786c 100644
--- a/superset/dashboards/commands/importers/v1/utils.py
+++ b/superset/dashboards/commands/importers/v1/utils.py
@@ -115,7 +115,7 @@ def import_dashboard(
# TODO (betodealmeida): move this logic to import_from_dict
config = config.copy()
for key, new_name in JSON_KEYS.items():
- if config.get(key):
+ if config.get(key) is not None:
value = config.pop(key)
try:
config[new_name] = json.dumps(value)
diff --git a/superset/datasets/commands/importers/v1/utils.py
b/superset/datasets/commands/importers/v1/utils.py
index 73c0ca5..882faf2 100644
--- a/superset/datasets/commands/importers/v1/utils.py
+++ b/superset/datasets/commands/importers/v1/utils.py
@@ -92,7 +92,7 @@ def import_dataset(
# TODO (betodealmeida): move this logic to import_from_dict
config = config.copy()
for key in JSON_KEYS:
- if config.get(key):
+ if config.get(key) is not None:
try:
config[key] = json.dumps(config[key])
except TypeError:
diff --git a/tests/datasets/commands_tests.py b/tests/datasets/commands_tests.py
index f72e7f3..84c1089 100644
--- a/tests/datasets/commands_tests.py
+++ b/tests/datasets/commands_tests.py
@@ -312,7 +312,7 @@ class TestImportDatasetsCommand(SupersetTestCase):
assert dataset.schema == ""
assert dataset.sql == ""
assert dataset.params is None
- assert dataset.template_params is None
+ assert dataset.template_params == "{}"
assert dataset.filter_select_enabled
assert dataset.fetch_values_predicate is None
assert dataset.extra is None
diff --git a/tests/fixtures/importexport.py b/tests/fixtures/importexport.py
index e1752fc..c815642 100644
--- a/tests/fixtures/importexport.py
+++ b/tests/fixtures/importexport.py
@@ -368,7 +368,7 @@ dataset_config: Dict[str, Any] = {
"schema": "",
"sql": "",
"params": None,
- "template_params": None,
+ "template_params": {},
"filter_select_enabled": True,
"fetch_values_predicate": None,
"extra": None,