I am trying to export and then import back a dashboard by using Superset's REST API. The documentation (https://superset.apache.org/docs/rest-api) for endpoint /dashboard/export states: "Exports multiple Dashboards and downloads them as YAML files." However, the resulting file is seemingly always .json (regardless of number of dashboards exported). Furthermore, when trying to import back into Superset, endpoint /dashboard/import seems to require a .zip file.
So:
- Documentation states .yaml file will be created
- Exporting actually creates .json file
- Import endpoint expects .zip file
Expected results
Expect to be able to export and then import back an unchanged dashboard file.
Actual results
Feb 19 16:27:14 superset gunicorn[15773]: ERROR:root:__init__() got an unexpected keyword argument 'passwords'
Feb 19 16:27:14 superset gunicorn[15773]: Traceback (most recent call last):
Feb 19 16:27:14 superset gunicorn[15773]: File "/usr/local/lib64/python3.8/site-packages/flask_appbuilder/api/__init__.py", line 84, in wraps
Feb 19 16:27:14 superset gunicorn[15773]: return f(self, *args, **kwargs)
Feb 19 16:27:14 superset gunicorn[15773]: File "/usr/local/lib/python3.8/site-packages/superset/views/base_api.py", line 79, in wraps
Feb 19 16:27:14 superset gunicorn[15773]: duration, response = time_function(f, self, *args, **kwargs)
Feb 19 16:27:14 superset gunicorn[15773]: File "/usr/local/lib/python3.8/site-packages/superset/utils/core.py", line 1286, in time_function
Feb 19 16:27:14 superset gunicorn[15773]: response = func(*args, **kwargs)
Feb 19 16:27:14 superset gunicorn[15773]: File "/usr/local/lib/python3.8/site-packages/superset/dashboards/api.py", line 722, in import_
Feb 19 16:27:14 superset gunicorn[15773]: command.run()
Feb 19 16:27:14 superset gunicorn[15773]: File "/usr/local/lib/python3.8/site-packages/superset/dashboards/commands/importers/dispatcher.py", line 57, in run
Feb 19 16:27:14 superset gunicorn[15773]: command = version(self.contents, *self.args, **self.kwargs)
Feb 19 16:27:14 superset gunicorn[15773]: TypeError: __init__() got an unexpected keyword argument 'passwords'
This error happens in v0.ImportDashboardsCommand in https://github.com/apache/superset/blob/master/superset/dashboards/commands/importers/dispatcher.py. The request should never reach that command as the v1 version is the one that gets executed first. However, version v1 fails because metadata.yaml is not in the uploaded .zip file as per https://github.com/apache/superset/blob/7bef5ab4d23faf571c8cbf2e55a623dac0ee7f64/superset/commands/importers/v1/utils.py.
Screenshots
How to reproduce the bug
- Create dashboard
- Export dashboard with
curl -v --cookie "session=<your_cookie>" --output dashboard.zip http://<your_host>/api/v1/dashboard/export/?q=[<your_dashboard_id>]
- do
cat dashboard.zip to check that a .json file was created instead
- Uploading the file back to
/dashboard/import as it was created results in a "Not a zip file" type of error
- Zipping the resulting .json from step 2. results in the error described in the previous section as not all needed files are in the archive
Environment
(please complete the following information):
- superset version: 1.0.0
- python version: 3.8.6
- node.js version:
node -v
Checklist
Make sure to follow these steps before submitting your issue - thank you!
I am trying to export and then import back a dashboard by using Superset's REST API. The documentation (https://superset.apache.org/docs/rest-api) for endpoint
/dashboard/exportstates: "Exports multiple Dashboards and downloads them as YAML files." However, the resulting file is seemingly always .json (regardless of number of dashboards exported). Furthermore, when trying to import back into Superset, endpoint/dashboard/importseems to require a .zip file.So:
Expected results
Expect to be able to export and then import back an unchanged dashboard file.
Actual results
This error happens in
v0.ImportDashboardsCommandinhttps://github.com/apache/superset/blob/master/superset/dashboards/commands/importers/dispatcher.py. The request should never reach that command as thev1version is the one that gets executed first. However, versionv1fails becausemetadata.yamlis not in the uploaded .zip file as perhttps://github.com/apache/superset/blob/7bef5ab4d23faf571c8cbf2e55a623dac0ee7f64/superset/commands/importers/v1/utils.py.Screenshots
How to reproduce the bug
curl -v --cookie "session=<your_cookie>" --output dashboard.zip http://<your_host>/api/v1/dashboard/export/?q=[<your_dashboard_id>]cat dashboard.zipto check that a .json file was created instead/dashboard/importas it was created results in a "Not a zip file" type of errorEnvironment
(please complete the following information):
node -vChecklist
Make sure to follow these steps before submitting your issue - thank you!