Skip to content

Commit

Permalink
fix: import dataset/dashboard empty keys (#13979)
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida authored Apr 7, 2021
1 parent ab0f5e3 commit 3b11654
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion superset/dashboards/commands/importers/v1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion superset/datasets/commands/importers/v1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/datasets/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def test_import_v1_dataset(self):
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
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/importexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
"schema": "",
"sql": "",
"params": None,
"template_params": None,
"template_params": {},
"filter_select_enabled": True,
"fetch_values_predicate": None,
"extra": None,
Expand Down

0 comments on commit 3b11654

Please sign in to comment.