krsnik93 opened a new issue #13239: URL: https://github.com/apache/superset/issues/13239
I am trying to export and then import back a dashboard by using Superset's REST API. The documentation for endpoint `/dashboard/export` states: "Exports multiple Dashboards and downloads them as YAML files." However, the resulting file is seemingly always .json. Furthermore, when trying to import back into Superset, endpoint `/dashboard/import` seems to require a .zip file. So: 1. Documentation (https://superset.apache.org/docs/rest-api) states .yaml file will be created 2. Exporting actually creates .json file (regardless of number of dashboards exported) 3. 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 1. Create dashboard 2. Export dashboard with ` curl -v --cookie "session=<your_cookie>" --output dashboard.zip http://<your_host>/api/v1/dashboard/export/?q=[<your_dashboard_id>]` 3. do `cat dashboard.zip` to check that a .json file was created instead 4. Uploading the file back to `/dashboard/import` as it was created results in a "Not a zip file" type of error 5. 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! - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any. - [x] I have reproduced the issue with at least the latest released version of superset. - [x] I have checked the issue tracker for the same issue and I haven't found one similar. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
