diff --git a/superset/dashboards/commands/importers/v1/utils.py b/superset/dashboards/commands/importers/v1/utils.py index 9802767b6..09d786ce3 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 73c0ca58a..882faf2ce 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 f72e7f367..84c108909 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 e1752fcb7..c815642f9 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,