Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing chart over API fails if the chart was built on top of a virtual dataset #13237

Closed
3 tasks done
krsnik93 opened this issue Feb 19, 2021 · 2 comments
Closed
3 tasks done
Labels
!deprecated-label:bug Deprecated label - Use #bug instead inactive Inactive for >= 30 days viz:charts:import Related to importing charts

Comments

@krsnik93
Copy link
Contributor

krsnik93 commented Feb 19, 2021

Importing chart over API fails if the chart was built on top of a virtual dataset. I exported the chart with the /chart/export endpoint and then tried POSTing the resulting .zip to /chart/import.

Expected results

Expect chart to get uploaded successfully.

Actual results

Feb 19 15:17:45 superset gunicorn[10599]:   File "/usr/local/lib/python3.8/site-packages/superset/models/slice.py", line 103, in cls_model
Feb 19 15:17:45 superset gunicorn[10599]:     return ConnectorRegistry.sources[self.datasource_type]
Feb 19 15:17:45 superset gunicorn[10599]: KeyError: 'view'
Feb 19 15:17:45 superset gunicorn[10599]: During handling of the above exception, another exception occurred:
Feb 19 15:17:45 superset gunicorn[10599]: Traceback (most recent call last):
Feb 19 15:17:45 superset gunicorn[10599]:   File "/usr/local/lib/python3.8/site-packages/superset/charts/api.py", line 993, in import_
Feb 19 15:17:45 superset gunicorn[10599]:     command.run()
Feb 19 15:17:45 superset gunicorn[10599]:   File "/usr/local/lib/python3.8/site-packages/superset/charts/commands/importers/dispatcher.py", line 66, in run
Feb 19 15:17:45 superset gunicorn[10599]:     raise exc
Feb 19 15:17:45 superset gunicorn[10599]:   File "/usr/local/lib/python3.8/site-packages/superset/charts/commands/importers/dispatcher.py", line 55, in run
Feb 19 15:17:45 superset gunicorn[10599]:     command.run()
Feb 19 15:17:45 superset gunicorn[10599]:   File "/usr/local/lib/python3.8/site-packages/superset/commands/importers/v1/__init__.py", line 71, in run
Feb 19 15:17:45 superset gunicorn[10599]:     raise self.import_error()
Feb 19 15:17:45 superset gunicorn[10599]: superset.charts.commands.exceptions.ChartImportError: Import chart failed for an unknown reason

How to reproduce the bug

  1. Create a virtual dataset in SQL Lab
  2. Create a chart on top of that dataset
  3. Export chart via REST API /chart/export endpoint with:
    curl -v --cookie "session=<your_cookie>" --output <filename>.zip http://<your_host>/api/v1/chart/export/?q=[<your_chart_id>]
  4. Try to import resulting .zip file with:
    curl 'http://<your_host>/api/v1/chart/import/' \ -X POST \ -H 'Cookie: session=<your_cookie>' \ -H "X-CSRF-Token: <your_csrf_token>" \ -F formData=@<filename>.zip \ -F overwrite=true \ --compressed \ --insecure

Environment

(please complete the following information):

  • superset version: 1.0.0
  • python version: 3.8.7
  • node.js version: v12.20.1

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.
@krsnik93 krsnik93 added the #bug Bug report label Feb 19, 2021
@junlincc junlincc removed the #bug Bug report label Feb 19, 2021
@junlincc
Copy link
Member

@dpgaspar could you please take a look? thanks Daniel!

@junlincc junlincc added viz:charts:import Related to importing charts !deprecated-label:bug Deprecated label - Use #bug instead labels Feb 19, 2021
@stale
Copy link

stale bot commented May 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label May 2, 2022
@yousoph yousoph closed this as completed Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead inactive Inactive for >= 30 days viz:charts:import Related to importing charts
Projects
None yet
Development

No branches or pull requests

3 participants