jchong9 opened a new issue, #45332: URL: https://github.com/apache/superset/issues/45332
## [SIP] Proposal for Including Applied Filter Settings in Excel and CSV Exports ### Motivation Superset exports currently contain the resulting chart or dashboard data, but not the filter selections that produced that data. This makes exported files difficult to interpret, reproduce, or share outside of Superset. This is particularly problematic when: - dashboard native filters affect chart results; - chart-level filters affect exported data; - exported files are consumed by users who cannot access the original dashboard; - multiple exports are compared over time. - The current export behavior should remain unchanged by default. Users should be able to explicitly choose whether filter metadata is included. This proposal builds on the idea discussed in [Discussion #44864](https://github.com/apache/superset/discussions/44864). ### Proposed Change Add filter metadata options directly to the existing export menus. #### CSV exports CSV export is available for charts. The CSV menu will provide three choices: 1. Without filter metadata * Preserves the current CSV export behavior. 2. Include filters in metadata comments * Adds a metadata section at the beginning of the CSV. * Metadata will use a comment prefix so the data remains recognizable as CSV. 3. Include filters as a separate file * Returns a ZIP containing: * the original CSV export; * a separate CSV containing the filter metadata. These options will be available from all relevant chart CSV export menus, including chart, Explore, drill-detail, and drill-by exports where applicable. #### Excel exports Excel export is available for dashboards and charts. The Excel menu will provide two choices: 1. Without filter metadata * Preserves the current Excel export behavior. 2. Include filters as a separate file * Returns a ZIP containing: * the original Excel export; * a separate Excel workbook containing the filter metadata. This will apply to dashboard data exports, dashboard image exports, and chart Excel exports. #### Filter metadata The metadata will include: - dashboard filters that affected the exported query; - chart filters that affected the exported query; - human-readable filter labels; - human-readable selected values or ranges; - the affected chart where applicable. The metadata will NOT include: - row-level security predicates; - generated SQL; - internal security clauses; - filters that did not affect the exported query. When no applicable filters exist, metadata will be omitted without causing the export to fail. Implementation will be delivered in two coordinated pull requests: 1. chart CSV export support; 2. chart and dashboard Excel export support. ### New or Changed Public Interfaces No new REST endpoints are required. Existing chart-data and dashboard Excel export endpoints will accept an optional filter-export mode. The default mode will preserve existing behavior. Potential request values are: ``` none inline separate ``` For CSV: - none returns the current CSV response; - inline returns CSV with comment metadata; - separate returns a ZIP containing the CSV and metadata CSV. For Excel: - none returns the current Excel response; - separate returns a ZIP containing the Excel export and metadata workbook. The following existing interfaces will be updated: - chart export request payloads; - dashboard Excel export request payloads; - chart export React menus; - dashboard export React menus; - chart-data response generation; - dashboard Excel workbook generation; - background Excel export task arguments. No changes are proposed to saved dashboard or chart form data, visualization definitions, Superset CLI commands, or deployment configuration. ### New dependencies No new npm or PyPI dependencies are required. The implementation will use existing CSV, ZIP, and Excel generation utilities already present in Superset. ### Migration Plan and Compatibility No database migration is required. No saved dashboards, charts, URLs, or bookmarks need to be updated. Existing exports remain compatible because: - the new request option is optional; - the default behavior remains unchanged; - existing clients that do not send the option continue receiving the current export format; - filter metadata is generated at export time and is not persisted. - The new ZIP responses only occur when a user explicitly selects the separate-file option. ### Rejected Alternatives No alternatives considered as of now. -- 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]
