fix(dashboard): build example-export sample data through the dataset query path#40976
fix(dashboard): build example-export sample data through the dataset query path#40976sha174n wants to merge 7 commits into
Conversation
The example-export data path now fetches rows through the dataset's own query builder and applies the dataset access check before reading any rows, so exported sample data is produced the same way as the chart-data path (column projection, per-row filters) and reflects the requester's dataset access. The row cap is applied at the SQL level via row_limit instead of after a full table read. A requester without access to a dataset yields no data file rather than the raw underlying table. Adds unit coverage for the access-denied and query-path branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds an end-to-end regression test: a Gamma user restricted by a row-level filter on birth_names exports the births dashboard and must only receive the rows the filter allows. Verified to fail against the pre-change data path (full table leaked) and pass after it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…failure The dataset query path signals failures via QueryResult.status (returning an empty frame) rather than raising, so a failed query would have written an empty Parquet. Treat a FAILED status as no data and omit the file, matching the prior raise-and-skip behavior. Adds unit coverage for the failed-query branch and restores the shared test role's permissions after the row-level-filter integration test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40976 +/- ##
==========================================
- Coverage 64.30% 64.29% -0.01%
==========================================
Files 2657 2657
Lines 144060 144059 -1
Branches 33216 33214 -2
==========================================
- Hits 92641 92626 -15
- Misses 49797 49810 +13
- Partials 1622 1623 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code Review Agent Run #f54a14Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code Review Agent Run #823800Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
The dashboard "export as example" data path (
export_dataset_datainsuperset/commands/dashboard/export_example.py) read dataset rows with a hand-builtpd.read_sql(...)straight against the dataset's engine. That skipped the dataset's own query builder, so the exported sample could differ from what the same user gets through the regular chart-data path.This routes the data export through the dataset's
query()method, so the sample is produced the same way as everywhere else:row_limitinstead of reading the full table and trimming afterward.The query path reports failures via status rather than raising, so a failed query now omits the data file instead of writing an empty Parquet, matching the previous behavior. No change for an admin/owner exporting datasets they fully control.
TESTING INSTRUCTIONS
New unit tests cover the access-denied, query-path, row-limit, and failed-query branches. A new integration test exports a dashboard as a user constrained by a per-row filter on the dataset and asserts the export only contains the rows that filter allows.
ADDITIONAL INFORMATION
🤖 Generated with Claude Code