Repository navigation
feat: add a command to import charts - #11743
Conversation
There was a problem hiding this comment.
This is not being used anywhere, seems like the result of a bad merge because we have an identical class method called parent_foreign_key_mappings (no leading underscore).
There was a problem hiding this comment.
This is necessary to preserve the parent ID in the config when importing, otherwise it gets deleted.
There was a problem hiding this comment.
This unit test is unrelated, but I thought about this case and decided to add it in this PR.
Codecov Report
@@ Coverage Diff @@
## master #11743 +/- ##
==========================================
+ Coverage 66.61% 67.20% +0.58%
==========================================
Files 897 899 +2
Lines 43463 43560 +97
Branches 4015 4015
==========================================
+ Hits 28955 29276 +321
+ Misses 14391 14180 -211
+ Partials 117 104 -13
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
b7bb575 to
7998a5e
Compare
* ImportChartsCommand * Fix type
Deleting a dataset soft-deletes it, so the global visibility filter hides the row from `Slice.table` while the chart itself survives. Exporting such a chart then produced a bundle with neither `dataset_uuid` on the chart YAML nor a `datasets/` file, and `ImportV1ChartSchema` — which has required `dataset_uuid` since the chart importer was added in apache#11743 — rejected Superset's own export with: {'dataset_uuid': ['Missing data for required field.']} Dashboards hit the same error because `ExportDashboardsCommand` exports its charts through `ExportChartsCommand`. Resolve the chart's dataset through the DAO with the visibility filter bypassed so a trashed dataset still reaches the bundle and the chart keeps its only link to it. The DAO base filter still applies, so a dataset the user cannot read stays unreachable. A chart whose dataset was hard-deleted has no row to resolve and still exports without the field, as before. Refs apache#44309 Deliberately not a closing keyword: this fixes the chart and dashboard half. The dataset GENERIC_COMMAND_ERROR reported in the same issue did not reproduce on master and is not addressed here, so the issue should stay open until that half is understood.
SUMMARY
This PR adds a new command
ImportChartsCommandto import a new bundle with exported charts (#11167).BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
Added unit tests for imports and validation.
ADDITIONAL INFORMATION