tdfs4ds.migration¶
tdfs4ds.migration
¶
tdfs4ds.migration — cross-store MIGRATION / promotion (lab → production) (v0.3.1.150).
Where :mod:tdfs4ds.read_federation attaches other feature stores read-only,
this package imports selected work from a distant (lab) store into the
principal (production) store — bringing along the temporal lineage graph, the
business dictionary, the Teradata vector index, the non-FS upstream objects the
process views depend on, the feature-value data (recompute or copy), and the
filter/time managers.
Two governed phases:
- :func:
plan_migration— READ-ONLY: resolve seeds in the source store, expand the upstream process closure (the migration unit), inventory + classify every object, detect name conflicts against the primary, run the replace downstream-safety gate, and return a manifest that requires approval. - :func:
migrate_objects— the only writer: executes an approved manifest.
:func:render_migration_report renders the manifest as an approval report;
:func:generate_migration_script / :func:write_migration_script emit a
standalone execution script with a baked-in approval map.
__all__
module-attribute
¶
__all__ = ['plan_migration', 'migrate_objects', 'render_migration_report', 'generate_migration_script', 'write_migration_script']
plan_migration
¶
plan_migration(seeds=None, source=None, *, all_domains: bool = True, target_data_domain: Optional[str] = None, data_strategy: str = 'recompute', attach: bool = True, database_map: Optional[Dict[str, Any]] = None) -> Dict[str, Any]
migrate_objects
¶
migrate_objects(plan: Dict[str, Any], approvals: Optional[Dict[str, str]] = None, *, dry_run: bool = False, rebuild_vector_index: bool = True, progress: Optional[Callable[[str], None]] = None) -> Dict[str, Any]
Execute an approved migration manifest against the primary store.
Parameters¶
plan : dict
The manifest from :func:tdfs4ds.plan_migration.
approvals : dict[str, str] | None
{conflict_key: 'skip'|'replace'} for every conflict. Required whenever
the plan has conflicts; a replace that is still blocking (the
downstream-safety gate) is rejected.
dry_run : bool
Validate approvals and return the plan of record without writing.
rebuild_vector_index : bool
Rebuild the Teradata vector index after BD migration (default True; skipped
unless VECTOR_STORE_BACKEND == 'teradata').
progress : callable(str) | None
Per-step progress hook (for the SSE panel).
Returns¶
dict
Execution report: pid_map (source→primary), per-object outcomes,
skipped/replaced, and any post-migration downstream compile breakages.
render_migration_report
¶
Render the migration manifest as an approval-ready report.
Parameters¶
plan : dict
A manifest from :func:tdfs4ds.plan_migration.
fmt : 'markdown' | 'html'
Output format (default markdown).
generate_migration_script
¶
generate_migration_script(plan: Dict[str, Any], approvals: Optional[Dict[str, str]] = None, *, data_strategy: Optional[str] = None) -> str
Return a standalone .py (string) that re-plans and executes this migration
with the given approvals baked in. Inspect before executing.
write_migration_script
¶
write_migration_script(plan: Dict[str, Any], out_path: Optional[str] = None, approvals: Optional[Dict[str, str]] = None, **kw) -> str
Write the generated migration script under tdfs4ds.SCHEDULING_SCRIPT_DIR
(or out_path); return its path.