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

   ### SUMMARY
   
   Follow-up to the async dashboard "Export Data to Excel" feature to properly 
handle charts that have no saved `query_context`. A chart persists its 
`query_context` only once it has been (re-)saved in Explore, so older charts 
have `params` (form data) but no context and previously failed mid-export or 
fell into the generic error bucket. This PR first makes such charts skip 
cleanly and get listed under the "no query context" remediation (covering 
`null`/`{}`/`{"queries": []}`/malformed values, not just a blank one), then 
goes further and **synthesizes a query context from the chart's saved form 
data** so those charts still export. Because the rebuild is a generic 
single-query mapping that does not reproduce plugin post-processing (pivot, 
rolling, forecast) or multi-query charts, it is gated behind a conservative, 
configurable viz-type allowlist (`EXCEL_EXPORT_REBUILD_VIZ_TYPES`, default 
`table`/`big_number_total`/`big_number`/`pie`); anything else without a saved 
context is still ski
 pped and listed for re-save, so no chart ever exports silently wrong or 
incomplete data.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — backend export-task behavior only.
   
   ### TESTING INSTRUCTIONS
   
   Run the unit tests: `pytest 
tests/unit_tests/tasks/test_export_dashboard_excel.py 
tests/unit_tests/common/test_form_data_query_context.py`. They cover the 
clean-skip cases (blank/`null`/`{}`/empty-queries/malformed), the form-data 
rebuild for an eligible viz type, and the skip-with-notice fallback for an 
ineligible (multi-query) viz type. End-to-end: export a dashboard containing a 
legacy chart with no saved `query_context` — an eligible chart (e.g. a table) 
now appears as a data sheet, while an ineligible one is listed in the email as 
needing a re-save in Explore.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] 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
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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