fix(datasets): preserve metric/column uuids on dataset export#42393
Draft
sadpandajoe wants to merge 2 commits into
Draft
fix(datasets): preserve metric/column uuids on dataset export#42393sadpandajoe wants to merge 2 commits into
sadpandajoe wants to merge 2 commits into
Conversation
Dataset folders reference metrics and columns by UUID. On export the recursive child serialization in ImportExportMixin.export_to_dict did not forward export_uuids, so exported metrics/columns carried no uuid. On import each child was recreated with a fresh random uuid while the folders JSON still pointed at the originals, so the item could no longer be matched to its custom folder and was re-homed to the default folder. Forward export_uuids into the recursive child export and accept uuid in the import column/metric schemas so the references round-trip intact. The import layer already recreates children with a provided uuid. Only the two dataset export paths (dataset and database exports) pass export_uuids=True, so behavior is unchanged for callers using the default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #42393 +/- ##
==========================================
- Coverage 65.25% 65.21% -0.04%
==========================================
Files 2794 2795 +1
Lines 157396 157549 +153
Branches 35982 36007 +25
==========================================
+ Hits 102706 102751 +45
- Misses 52713 52820 +107
- Partials 1977 1978 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Address review feedback on the metric/column uuid export fix: - helpers.py: when importing a dataset config as a NEW dataset (edited dataset uuid) while the original still exists, an unchanged child uuid would be treated as new and violate the globally-unique constraint on table_columns/sql_metrics. Drop the incoming uuid for a new child whose uuid already exists so UUIDMixin assigns a fresh one, restoring the pre-change clone-via-YAML behavior. - import_test.py: give the round-trip folder leaves their semantic type and assert the full imported folder structure; add a regression test for the clone path. - commands_tests.py: reword a time-anchored comment. - UPDATING.md: note that exports now include child uuid fields and fail schema validation on older releases (mixed-version fleets). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Fixes metric/column custom-folder configuration being lost on dataset import (sc-105008 / PPR-1263; customer: Ippen-digital).
Root cause: dataset folder leaf nodes reference metrics/columns by UUID, but
ImportExportMixin.export_to_dictdid not forwardexport_uuidsto the recursive child export, and the import schemas did not acceptuuid. So exported metrics/columns arrived without a uuid, the importer minted fresh ones viaUUIDMixin, and the persistedfoldersJSON kept pointing at the old uuids, so the frontend re-homed the metrics to the default folder. This forwardsexport_uuidsinto the recursive child export and acceptsuuidinImportV1ColumnSchema/ImportV1MetricSchema, so folder references round-trip. A clone-safety guard drops an incoming childuuidthat already exists globally (importing a copy under a new parent), reverting to fresh-uuid behavior for that clone and avoiding the unique-constraint conflict. No DB migration;uuidalready exists viaUUIDMixinand is only emitted whenexport_uuids=True.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable: backend export/import serialization change, no UI surface. Covered by an end-to-end export→import round-trip regression test asserting folder membership is retained, plus a clone-collision test.
TESTING INSTRUCTIONS
Tests:
tests/unit_tests/datasets/commands/importers/v1/import_test.py(round-trip + clone collision), updatedexport_test.pyanddatasets/commands_tests.py.ADDITIONAL INFORMATION