When exporting certain datasets, the serialized version of the dataset is invalid.
This causes validation with marshmallow to fail when you try to import it again.
How to reproduce the bug
In the superset UI:
Open any dataset
Go to the settings tab and enter any value in the TEMPLATE PARAMETERS field and save. This is enough to trigger the bug, but you can also remove the value from the TEMPLATE PARAMETERS field and save again, and the bug will still persist.
Export the dataset using the export feature.
Immediately try to import the same dataset again.
Screenshots/recordings
Superset version
3.0.4
Python version
3.9
Node version
16
Browser
Chrome
Additional context
In order to work around this issue:
Open the zip file and extract the dataset yaml file
Find the field called template_params. If the dataset is broken the value of this field will be a string value or an empty string like this: template_params: ''
Change the value to null like this -> template_params: null
Save the file and place it back into the zip file that was exported.
Import the dataset back into superset
Stack:
2024-03-08 11:59:32,978:WARNING:superset.views.base:CommandException
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/usr/local/lib/python3.9/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
return f(self, *args, **kwargs)
File "/app/superset/views/base_api.py", line 127, in wraps
raise ex
File "/app/superset/views/base_api.py", line 121, in wraps
duration, response = time_function(f, self, *args, **kwargs)
File "/app/superset/utils/core.py", line 1535, in time_function
response = func(*args, **kwargs)
File "/app/superset/utils/log.py", line 255, in wrapper
value = f(*args, **kwargs)
File "/app/superset/views/base_api.py", line 108, in wraps
return f(self, *args, **kwargs)
File "/app/superset/datasets/api.py", line 937, in import_
command.run()
File "/app/superset/datasets/commands/importers/dispatcher.py", line 64, in run
raise exc
File "/app/superset/datasets/commands/importers/dispatcher.py", line 57, in run
command.run()
File "/app/superset/commands/importers/v1/__init__.py", line 73, in run
self.validate()
File "/app/superset/commands/importers/v1/__init__.py", line 111, in validate
raise CommandInvalidError(
superset.commands.exceptions.CommandInvalidError: Error importing dataset
Checklist
[x] I have searched Superset docs and Slack and didn't find a solution to my problem.
[x] I have searched the GitHub issue tracker and didn't find a similar bug report.
[x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Bug description
When exporting certain datasets, the serialized version of the dataset is invalid. This causes validation with marshmallow to fail when you try to import it again.
How to reproduce the bug
In the superset UI:
TEMPLATE PARAMETERS
field and save. This is enough to trigger the bug, but you can also remove the value from theTEMPLATE PARAMETERS
field and save again, and the bug will still persist.Screenshots/recordings
Superset version
3.0.4
Python version
3.9
Node version
16
Browser
Chrome
Additional context
In order to work around this issue:
Stack:
Checklist