Skip to content

fix(export): Full CSV/Excel exports respecting SQL_MAX_ROW config#33214

Merged
Vitor-Avila merged 2 commits into
masterfrom
fix/download-full-csv
Apr 23, 2025
Merged

fix(export): Full CSV/Excel exports respecting SQL_MAX_ROW config#33214
Vitor-Avila merged 2 commits into
masterfrom
fix/download-full-csv

Conversation

@Vitor-Avila
Copy link
Copy Markdown
Contributor

@Vitor-Avila Vitor-Avila commented Apr 22, 2025

SUMMARY

Superset provides two CSV/Excel export options:

  • Export to .CSV/Excel: Downloads the chart data (respecting the chart's row limit).
  • Export to full .CSV/Excel: This option is behind the ALLOW_FULL_CSV_EXPORT FF (disabled by default) and only available to Table charts. It would download all data from the chart query (up to the SQL_MAX_ROW config).

The full download was not working properly and instead of getting the SQL_MAX_ROW limit, it was getting a default limit of 5000.

This is a follow up to #31241 and #31720, to fix this flow so that the full download respects the SQL_MAX_ROW coinfig.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No UI changes.

Before this change, Export to full .CSV/Excel results in a file with <= 5k rows. Now, it results in a file with <= SQL_MAX_ROW rows.

TESTING INSTRUCTIONS

Updated one frontend test. For manual testing:

  1. Enable the ALLOW_FULL_CSV_EXPORT FF.
  2. Set SQL_MAX_ROW to 100000.
  3. Create a table chart using the flights dataset with the row limit set to 15000 and add it to a dashboard.
  4. Access the dashboard.
  5. Click on the chart menu, then Download > Export to .CSV. Validate the file includes 15k rows of data.
  6. Click on the chart menu, then Download > Export to full .CSV. Validate the file includes ~55k rows of data.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot Bot added dashboard:export Related to exporting dashboards data:csv Related to import/export of CSVs labels Apr 22, 2025
Copy link
Copy Markdown

@korbit-ai korbit-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Unmemoized Redux Selector ▹ view 🧠 Not in standard
Files scanned
File Path Reviewed
superset-frontend/src/dashboard/components/gridComponents/Chart.jsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines +153 to +155
const maxRows = useSelector(
state => state.dashboardInfo.common.conf.SQL_MAX_ROW,
);

This comment was marked as resolved.

@Vitor-Avila Vitor-Avila requested a review from kgabryje April 23, 2025 01:30
Copy link
Copy Markdown
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rusackas
Copy link
Copy Markdown
Member

If I understand correctly, the FF currently lets you grab the entire table regardless of SQL_MAX_ROW. On the one hand, I appreciate this fix, as such a feature could nuke the DB and melt your computer.

On the other hand, this is a departure from behavior some people have come to expect. It's kind of a breaking change, but that's debatable... this almost feels like a bug fix given the above. Nevertheless, I think there should be a note in UPDATING.md about it, and if you want bonus points, maybe we could surface a tooltip or something that propagates SQL_MAX_ROW so the user knows how many rows they can expect.

@rusackas
Copy link
Copy Markdown
Member

After the above, I would almost imagine we could consider turning the FF on full time and deprecating it, which would be nice.

@Vitor-Avila
Copy link
Copy Markdown
Contributor Author

@rusackas I think this was already the case before. @kgabryje recently refactored the dashboard loading for performance improvements (#31241), and if you check the superset-frontend/src/dashboard/containers/Chart.jsx file in there maxRows was already set it this way:

...
maxRows: common.conf.SQL_MAX_ROW,
...

I thought about that too (we don't heavily expose this FF in Preset so I wasn't sure) but I think it always had this "precautionary" measure.

@rusackas
Copy link
Copy Markdown
Member

If this doesn't really change the existing behavior, then I'm fine with it as is, merge away! If it does change the behavior, we should probably note it in UPDATING.md so folks are made ware.

@Vitor-Avila Vitor-Avila changed the title fix(export): Full CSV/Excel downloads respecting SQL_MAX_ROW config fix(export): Full CSV/Excel exports respecting SQL_MAX_ROW config Apr 23, 2025
@Vitor-Avila
Copy link
Copy Markdown
Contributor Author

thanks @rusackas 🙏 I've updated the description to provide additional context about the change here. Let me know if you have any questions!

@Vitor-Avila Vitor-Avila merged commit f7b7aac into master Apr 23, 2025
61 of 62 checks passed
@Vitor-Avila Vitor-Avila deleted the fix/download-full-csv branch April 23, 2025 16:13
@michael-s-molina michael-s-molina added the v5.0 Label added by the release manager to track PRs to be included in the 5.0 branch label Apr 24, 2025
michael-s-molina pushed a commit that referenced this pull request Apr 24, 2025
LevisNgigi pushed a commit to LevisNgigi/superset that referenced this pull request Jun 18, 2025
alexandrusoare pushed a commit to alexandrusoare/superset that referenced this pull request Jun 19, 2025
@mistercrunch mistercrunch added 🍒 5.0.0 Cherry-picked to 5.0.0 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Jul 29, 2025
@dosubot dosubot Bot mentioned this pull request Jan 13, 2026
3 tasks
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels dashboard:export Related to exporting dashboards data:csv Related to import/export of CSVs size/S v5.0 Label added by the release manager to track PRs to be included in the 5.0 branch 🍒 5.0.0 Cherry-picked to 5.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants