apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.72k stars 13.85k forks source link

Unable to export Dashboards #23349

Open kashifjavedaddo opened 1 year ago

kashifjavedaddo commented 1 year ago

A clear and concise description of what the bug is.

How to reproduce the bug

  1. Go to Dashboards.
  2. Click on Export in front of any dashboard
  3. See error

Expected results

A file dialog box should open allowing to select the path where to save the exported zip file.

Actual results

The file dialog box is not show. Rather a busy cursor animation in form of superset logo keeps showing in middle of screen as shown in screen shot

Screenshots

If applicable, add screenshots to help explain your problem.

image

Environment

(please complete the following information):

Checklist

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

2023-03-13 18:01:51,088:ERROR:root:send_file() got an unexpected keyword argument 'attachment_filename' Traceback (most recent call last): File "/home/addo/superset/lib/python3.8/site-packages/flask_appbuilder/api/init.py", line 109, in wraps return f(self, *args, kwargs) File "/home/addo/superset/lib/python3.8/site-packages/superset/views/base_api.py", line 113, in wraps raise ex File "/home/addo/superset/lib/python3.8/site-packages/superset/views/base_api.py", line 110, in wraps duration, response = time_function(f, self, *args, *kwargs) File "/home/addo/superset/lib/python3.8/site-packages/superset/utils/core.py", line 1524, in time_function response = func(args, kwargs) File "/home/addo/superset/lib/python3.8/site-packages/flask_appbuilder/api/init.py", line 181, in wraps return f(self, *args, *kwargs) File "/home/addo/superset/lib/python3.8/site-packages/superset/utils/log.py", line 245, in wrapper value = f(args, **kwargs) File "/home/addo/superset/lib/python3.8/site-packages/superset/dashboards/api.py", line 783, in export response = send_file( TypeError: send_file() got an unexpected keyword argument 'attachment_filename' 2023-03-13 18:01:51,106:INFO:werkzeug:192.168.1.120 - - [13/Mar/2023 18:01:51] "GET /api/v1/dashboard/export/?q=!(17)&token=QKK3jmi-C HTTP/1.1" 500 -

Additional context

Add any other context about the problem here.

kashifjavedaddo commented 1 year ago

Hi everyone, We are facing above issue in apache superset installed from scratch on ubuntu. Looking forward to hearing from experts about possible resolution. Have a nice day. Regards, Kashif Javed Rana

santoshmallah commented 1 year ago

I am also getting the same error I have resolved this by modifying the code in the dashboard API here is the steps. Go to this location /home/addo/superset/lib/python3.8/site-packages/superset/dashboards/api.py", line 783

change this code


response = send_file(
                buf,
                mimetype="application/zip",
                as_attachment=True,
                download_name=filename,
                # attachment_filename=filename,
            )

I hope this will work for you.

kashifjavedaddo commented 1 year ago

Thank you so much Santosh Mallah.

It worked like a charm.

I did the same for charts as well and am able to export both now.

Thanks once again.

Regards,

Kashif Javed Rana

nairsmalu commented 1 year ago

@santoshmallah when I do this, I get the following error: TypeError: No name provided for attachment. Either set 'download_name' or pass a path instead of a file.

toransahu commented 1 year ago

I'm also facing the exact issue. I think this issue should be kept open.

The fix mentioned here is just a workaround, it needs to be fixed in the repo.

I am also getting the same error I have resolved this by modifying the code in the dashboard API here is the steps. Go to this location /home/addo/superset/lib/python3.8/site-packages/superset/dashboards/api.py", line 783

change this code

response = send_file(
                buf,
                mimetype="application/zip",
                as_attachment=True,
                download_name=filename,
                # attachment_filename=filename,
            )

I hope this will work for you.

toransahu commented 1 year ago

Seems like the fix /pull/24033 has already merged into the master. superset > 2.1.0 should have the fix.

PS: It got introduced because of a deprecating change https://github.com/pallets/flask/commit/15a3e82823c894185771486510027a65295bcf94 in Flask

kashifjavedaddo commented 4 months ago

Hi,

We are facing the same issue on two superset instances after upgrading to Version 3.1.1 on both instances. After clicking on Export icon, busy cursor keeps running and export file is not downloaded.

I have checked the code in python3.9/site-packages/superset/dashboards/api.py:

It is as it should be as shown below:

    response = send_file(
            buf,
            mimetype="application/zip",
            as_attachment=True,
            download_name=filename,
        )

Please reopen this issue and assist in solving the problem.