Repository navigation
docs(migrate): finalize in-store migration with dry_run=False - #319
Open
dimitri-yatsenko wants to merge 5 commits into
Open
dimitri-yatsenko wants to merge 5 commits into
dimitri-yatsenko wants to merge 5 commits into
Conversation
The guide finalized with migrate_external(schema, finalize=True), which runs with the default dry_run=True and changes nothing. Describe the in-store steps as the migration now runs them: store configuration, the up-front file check, verifying the _v2 columns, and what migrate_external_pointers_v2 refuses.
dimitri-yatsenko
requested review from
MilagrosMarin,
lum-agilyti and
ttngu207
November 23, 2026 23:09
…arlier releases - Option A, step 2: copy_table_data converts in-store columns as it copies, with the declaration and store requirements. - Option A, step 4: tables copied in step 2 need no further step; migrate_external_pointers_v2 converts one column of a table still in the pre-2.0 layout and swaps it in. - Option B, step 4: show the filepath preview's problems; a preview needs the stores configured and reachable; failure, finalize checks, and nullability; how to recover after running this step with an earlier 2.x release.
…LL after repair - Pre-2.0 blob and attachment files are under the original database name: pass legacy_database when migrating or copying from a copy, with the create_parallel_schema route spelled out in Option A step 4 and Option B. - Keep the default schema_prefix on a store that points to the pre-2.0 location, and what garbage collection does with schema_prefix "". - "subfolding": null means the pre-2.0 default [2, 2]. - Repair cannot restore NOT NULL lost by an earlier release's finalize; restore it in SQL. - The garbage collection guide says how migrated pre-2.0 files are kept.
…ilepath@> references State in both pages the files garbage collection keeps in the root-level layout, the case it does not cover (files in a subfolder that only other schemas reference), and to preview with dry_run=True.
Passing a subset of the schemas that share a store is safe except with
schema_prefix "", where a file in a subfolder of {schema}/ that only
other schemas reference is listed as an orphan. Point to the Root-Level
Layout section from the paragraph and the code comment.
This branch has not been deployed
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
The migration guide's in-store steps did not lead to columns that DataJoint 2.0 reads. Option B finalized with
migrate_external(schema, finalize=True), which runs with the defaultdry_run=Trueand changes nothing. Option A told readers to runmigrate_external_pointers_v2on a column declared by 2.0, which holds no pre-2.0 pointers. This PR describes both options as the fix in datajoint/datajoint-python#1753 runs them.Related issue: datajoint/datajoint-python#1698
Changes
Option A, step 2:
copy_table_dataconvertsblob@store,attach@store, andfilepath@storecolumns as it copies.<blob@raw>.subfoldingif one was set. Leavingsubfoldingout, or setting it tonullas the configuration template does, means the pre-2.0 default[2, 2].legacy_database.schema_prefixon that store. Withschema_prefix: "", the schema-addressed section is the folder that also holds the pre-2.0 files. The guide lists what garbage collection then keeps, the case it does not cover, and says to preview withdry_run=True.Option A, step 4: tables copied in step 2 need no further step.
migrate_external_pointers_v2converts one column of a table still in the pre-2.0 layout. It swaps in a JSON column and keeps the original as<name>_v1. A column already declared by 2.0 is refused.create_parallel_schema('my_pipeline', 'my_pipeline_copy', copy_data=True), thenmigrate_external_pointers_v2(..., legacy_database='my_pipeline'), or Option B on the copy withmigrate_external(..., legacy_database='my_pipeline').Option B, step 4:
dry_run=False.schema_prefixand the samesubfoldingif one was set (nullmeans the default).legacy_databasetomigrate_external.migrate_externalandmigrate_filepathboth print the files that cannot be found._v2columns the run added. Finalize checks the_v2columns first and keeps required columns required._v2columns that do not read, and repairs columns already finalized.NOT NULL, which the earlier release's finalize dropped. The guide gives the SQL statement that restores it, and says whyalter()cannot do it while the<name>_v1columns remain.Garbage collection guide: a new "Root-Level Layout" section. Both pages state the same behavior, which matches the
gc.pydocstring in fix(migrate): 0.14 blob@, attach@ and filepath@ columns read in 2.x after migration datajoint-python#1753. Withschema_prefix: ""only, garbage collection keeps:<blob@>or<attach@>value) or a<filepath@>reference points to;{schema}/, with no subfolder;~external_*tables, reported underskipped_schemas.It reads references only from the schemas it collects, in the store it collects. A file in a subfolder of
{schema}/, not named as pre-2.0 DataJoint named its files, that only rows of other schemas reference (for example a<filepath@>file) is still listed as an orphan. The pages say to pass every schema whose rows reference files in the store, such as a copy migrated withlegacy_database, to the same collector, and to preview withdry_run=True.The "Multiple Schemas" section, which says any subset of the schemas sharing a store may be collected, and its code comment now name the root-level layout as the exception and point to "Root-Level Layout".
Tests
python scripts/check_markdown_lists.py srcpasses.create_parallel_schema, garbage collection withschema_prefix: "","subfolding": null, and theNOT NULLstatement.Merge together with, or after, datajoint/datajoint-python#1753 is released, since the guide describes its behavior.