superset icon indicating copy to clipboard operation
superset copied to clipboard

While exporting CSV , only the entries on first page are getting downloaded even when user is on other pages

Open pratikgera123 opened this issue 3 years ago • 32 comments

When multiple pages are present in a report and user clicks on export CSV , only the data from first page is getting exported in CSV even when any other page is selected.

How to reproduce the bug

  1. Open any report
  2. Navigate to any other page using pagination
  3. Click on export CSV

Expected results- Csv file with entries of current page should get downloaded

Actual results- CSV file with entries of first page getting downloaded

Screenshots

image

Environment

  • browser :Chrome
  • superset version: 1.3.1

pratikgera123 avatar Dec 23 '21 12:12 pratikgera123

@villebro could you think of a possible solution for this one ?

amitmiran137 avatar Jan 02 '22 01:01 amitmiran137

Hi @amitmiran137 ! I would like to work on this issue if nobody has already taken it up. Thanks.

noobyogi0010 avatar Jan 11 '22 18:01 noobyogi0010

Any update on which version can we expect this, also in the above we are using sql templating in datasets.

Hi @amitmiran137 ! I would like to work on this issue if nobody has already taken it up. Thanks.

nijcap01 avatar Jan 13 '22 10:01 nijcap01

Hello @noobyogi0010 that would be great! Let me know if you are still interested in working on this issue

geido avatar Jan 24 '22 13:01 geido

@noobyogi0010 @geido Our customer also has issues with the combination of server pagination & csv export. The behaviour is different from exporting from a chart without server pagination.

In a "normal" chart, all pages would be downloaded (e.g. 10 pages a 10 entries = 100 row csv). In a "server paged" chart, the "export CSV" function will

  • download the first page only
  • ignore changes to "show n entries" (always use the default "server page length")

I would suggest not necessarily going @pratikgera123's proposed way (download the current instead of the first page) but instead harmonizing "server paged" CSV export with normal CSV export, e.g. they should behave the same. The user of a dashboard does not necessarily even know what server paging is and whether it's used, so they expect csv to behave the same either way. We had to suggest to our users to go via "view chart in explore", disable server pagination, and download from there. Not the best user experience, especially given that we have quite some users.

Ideally, the CSV export option should offer a pop-up where such things can be selected before downloading ("download all pages" vs. "download current page", override for limit, etc.).

hosswald avatar Jan 24 '22 13:01 hosswald

While downloading the CSV file irrespective of pagination i.e. 10/20/50 items or "All" items in the list, the downloaded file consists first 10/20 records as they were set for pagination for display. Validated on multiple reports and different datasets.

Expected - "Export CSV" option should be extracting records displayed on the view with respect to no. of records set to display on single page

"Export full CSV" option should extract all records.

Actual - Fixed number of records are extracted from both the options .

Pagination

ankuraga2022 avatar Feb 09 '22 09:02 ankuraga2022

When multiple pages are present in a report and user clicks on export CSV , only the data from first page is getting exported in CSV even when any other page is selected.

How to reproduce the bug

  1. Open any report
  2. Navigate to any other page using pagination
  3. Click on export CSV

Expected results- Csv file with entries of current page should get downloaded

Actual results- CSV file with entries of first page getting downloaded

Screenshots

image

Environment

  • browser :Chrome
  • superset version: 1.3.1

I am also getting the same issue. Can anyone suggest if we can expect this fix in near future?

ajaysharma202 avatar Feb 09 '22 10:02 ajaysharma202

Hi Team,

Any update on this item, our client is following us regularly on this, Please let us which version we are targeting this so that we can respond accordingly.

Thanks

nijcap01 avatar Mar 23 '22 03:03 nijcap01

I am also facing saME ISSUE

Narendra678 avatar Apr 29 '22 11:04 Narendra678

same issue

huimingz avatar May 19 '22 14:05 huimingz

I am also having the same issue.

vicmion avatar May 23 '22 14:05 vicmion

Hi @geido I would like to work on this issue if no one else is working on it. I was able to reproduce it locally and I think that the issue is that related to the attribute row_offset is always sent as 0 in the post request when exporting as csv.

If no one is working on this, I can try resolving it.

LahmerIlyas avatar May 24 '22 16:05 LahmerIlyas

Hi @geido I would like to work on this issue if no one else is working on it. I was able to reproduce it locally and I think that the issue is that related to the attribute row_offset is always sent as 0 in the post request when exporting as csv.

If no one is working on this, I can try resolving it.

Hi @LahmerIlyas sure thing. Contributions are more than welcome. Let me know if you need any help with this!

geido avatar May 24 '22 17:05 geido

@geido I was able to resolve the issue. Apparetly the ownstate prop was not being passed to ConnectedExploreChartHeader and the useExploreAdditionalActionsMenu() hook. I will create a PR for that

LahmerIlyas avatar May 24 '22 18:05 LahmerIlyas

Hi Team,

Thanks for reply.

What do you mean by ownstate? and useExploreAdditionalActionsMenu() hook

Is it resolved? may i know what changes i have make, please let me know.

Regards, Naren


From: Ilyas @.> Sent: 24 May 2022 23:55 To: apache/superset @.> Cc: Narendra Reddy @.>; Comment @.> Subject: Re: [apache/superset] While exporting CSV , only the entries on first page are getting downloaded even when user is on other pages (Issue #17861)

@geidohttps://github.com/geido I was able to resolve the issue. Apparetly the ownstate prop was not being passed to ConnectedExploreChartHeader and the useExploreAdditionalActionsMenu() hook. I will create a PR for that

— Reply to this email directly, view it on GitHubhttps://github.com/apache/superset/issues/17861#issuecomment-1136293985, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVFA24WVCUIPPOR5WUJOI2LVLUNJXANCNFSM5KUWD5CQ. You are receiving this because you commented.Message ID: @.***>

Narendra678 avatar May 27 '22 12:05 Narendra678

@Narendra678 it was a bug in the code, and I resolved it and submitted a pull request(https://github.com/apache/superset/pull/20178/files) for it, but no one reviewed it yet.

Here is a video of how it looks:

https://user-images.githubusercontent.com/31275446/170707907-46b291d8-8a28-47e5-af25-061529ab40d2.mp4

LahmerIlyas avatar May 27 '22 13:05 LahmerIlyas

@geido could you help me getting the PR reviewed.

LahmerIlyas avatar May 27 '22 16:05 LahmerIlyas

@Narendra678 it was a bug in the code, and I resolved it and submitted a pull request(https://github.com/apache/superset/pull/20178/files) for it, but no one reviewed it yet.

Here is a video of how it looks:

output.mp4

Hi LahmerIlyas, thanks for your help! it is solved my issue.

MengXinAlex avatar May 31 '22 01:05 MengXinAlex

In my case, with server pagination enabled, both option behave same way and download only first page. Is this PR going to make "Full CSV Export" option download all pages ?

mdeshmu avatar Jun 08 '22 07:06 mdeshmu

@mdeshmu with this PR, when server side pagination is enabled, export to csv will only download the selected page.

LahmerIlyas avatar Jun 08 '22 08:06 LahmerIlyas

@LahmerIlyas How will it behave when i choose "All" entries. image

mdeshmu avatar Jun 08 '22 08:06 mdeshmu

In Table Chart's configuration, I have server page length set to 10. When in dashboard I change the page size to 50 yet it still downloads 10 rows. My expectation is it would download 50 rows.

mdeshmu avatar Jun 08 '22 09:06 mdeshmu

@mdeshmu I tried changing the page size to 50 and it downloaded a 50 rows csv file export 50 items

LahmerIlyas avatar Jun 08 '22 10:06 LahmerIlyas

@LahmerIlyas Please confirm, you are testing with "Export CSV"? How does "Export CSV" behave when you choose "All" option? How does ""Export Full CSV" behave after your changes?

mdeshmu avatar Jun 09 '22 05:06 mdeshmu

@mdeshmu Yes, I confirm that I'm using "Export CSV". When you choose "All" option, it will download all rows (Keep in mind that this might freez your browser if you have lot of rows). For the "Export Full CSV", this PR doesn't implement this feature (I'm okay with contributing such feature if the maintainers are okay with it).

LahmerIlyas avatar Jun 09 '22 08:06 LahmerIlyas

@LahmerIlyas "Export Full CSV" feature is already there controlled via flag ALLOW_FULL_CSV_EXPORT but it doesn't work as expected. My understanding is, it should export full csv irrespective of what page you are on in dashboard or chart's server page length value.

mdeshmu avatar Jun 09 '22 13:06 mdeshmu

Any update on this issue, is above PR included in any version?

nijcap01 avatar Jul 02 '22 11:07 nijcap01

Hi, im having this issue too.

mike-fischer1 avatar May 20 '23 15:05 mike-fischer1

Hello. As this issue has been stale for a while now, I'll be closing it. If anyone experiences this issue in a recent version of Superset, please feel free to submit a new one.

geido avatar Feb 22 '24 17:02 geido

This is still an issue for me on 3.1.0, when pagination is enabled only the first page is downloaded even if the 'ALLOW_FULL_CSV_EXPORT' flag has been enables.

gstamatakiswxm avatar Apr 01 '24 11:04 gstamatakiswxm