hughhhh opened a new pull request, #41133:
URL: https://github.com/apache/superset/pull/41133

   ### SUMMARY
   
   Adds an asynchronous **"Export Data to Excel"** action to the dashboard 
Download menu. A new `POST /api/v1/dashboard/<pk>/export_xlsx/` endpoint 
enqueues a Celery task that re-runs each chart's saved query context under the 
requesting user with the live dashboard filter state applied, streams the 
results into a constant-memory multi-sheet `.xlsx` (one worksheet per chart, 
tab-nested charts included), uploads it to S3, and emails the user a 
time-limited pre-signed download link. The feature is disabled until 
`EXCEL_EXPORT_S3_BUCKET` is set (the endpoint returns `501` otherwise) and is 
gated on the Dashboard `can_export` permission. The branch also carries a small 
pre-existing `package-lock.json` lockfile bump, committed separately so it can 
be dropped independently.
   
   Key design decisions (resolving gaps in the spec):
   - Reuses the existing chart-data row caps (`ROW_LIMIT`/`SQL_MAX_ROW`) plus 
an Excel per-sheet row clamp — no new limit config.
   - Extends `get_dashboard_filter_context` with an `active_data_mask` kwarg 
(backward compatible) and extracts the shared query-context merge helper.
   - Streaming writer sanitizes sheet names (forbidden chars, 31-char cap, 
de-dupe) and quotes formula-like cells (`= + - @`) to prevent injection.
   - Embedded/guest-token users are excluded in v1 (they have no email for 
delivery) → `400`.
   - New config keys: `EXCEL_EXPORT_S3_BUCKET`, `EXCEL_EXPORT_S3_KEY_PREFIX`, 
`EXCEL_EXPORT_LINK_TTL_SECONDS`, `EXCEL_EXPORT_S3_CLIENT_KWARGS`. Requires a 
Celery worker, SMTP, and an S3 bucket (see UPDATING.md / docs).
   
   ### TESTING INSTRUCTIONS
   
   - Unit: `pytest 
tests/unit_tests/{utils/excel_streaming_tests.py,utils/s3_tests.py,charts/test_dashboard_filter_context.py,dashboards/test_excel_export_email.py,dashboards/test_excel_export_layout.py,tasks/test_export_dashboard_excel.py}`
 (92 pass).
   - Frontend: `cd superset-frontend && npm run test -- DownloadMenuItems` (12 
pass).
   - Integration: `pytest tests/integration_tests/dashboards/api_tests.py -k 
export_xlsx`.
   - Manual E2E: set `EXCEL_EXPORT_S3_BUCKET` (+ 
`EXCEL_EXPORT_S3_CLIENT_KWARGS` for MinIO/LocalStack), run a Celery worker and 
SMTP; trigger **Download → Export Data to Excel** on a tabbed, filtered 
dashboard; confirm the emailed pre-signed link downloads a workbook with one 
sheet per chart reflecting the active filters.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags: none (gated by the `EXCEL_EXPORT_S3_BUCKET` 
config)
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to