villebro opened a new pull request #16017: URL: https://github.com/apache/superset/pull/16017
### SUMMARY This PR fixes native filter metadata in versioned import/export of dashboards by doing the following: - export all datasets referenced in native filters, even those not referenced by charts in dashboard. - replaces `datasetId` with `datasetUuid` in native filter targets to ensure that dataset reference is based on UUID, not numeric id. Other bycatch fixes that were found while testing: - Fix datatype of `query_context` in `ImportV1ChartSchema`, which should be `String`, not `Dict` (caused a marshmallow schema validation exception). - `datasource_type` in `dataset_info` was set as `view` if the table was a virtual table, which caused an exception when importing virtual datasets. Since virtual datasets are in fact regular `table` datasources, we just reference the `datasource_type` of the imported dataset. ### SCREENSHOT Now native filter targets are referencing `datasetUuid` instead of `datasetId`:  ### TESTING INSTRUCTIONS 1. enable the "VERSIONED_EXPORT" feature flag 2. export a dashboard that had only one chart and two native filters, one referencing the same dataset as the chart and another not referenced by the chart 3. check that the native filter configurations in the dashboard metadata contain `datasetUuid` instead of `datasetId` references 4. delete the exported dashboard, chart and dataset only referenced by the native filter 5. import the exported bundle 6. make sure the imported dashboard works correctly, and that both datasets are imported correctly and native filter configurations are correct ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Has associated issue: closes #15484 , closes #15531 - [ ] 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 -- 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]
