Skip to content

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__ = ['dataset_access', 'process_run_access', 'write_access_script', 'check_access', '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, run_user: Optional[str] = None, dataset_readers=None, sanity='cheap') -> 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_migration_report(plan: Dict[str, Any], fmt: str = 'markdown') -> str

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.

dataset_access

dataset_access(dataset: str, readers=None) -> Dict[str, Any]

The GRANTs a user needs to read dataset ('db.name' or a name in the view database), for any dataset, migrated or not: SELECT for the readers, and what the dataset's database must hold to resolve the view (the store's tables, its TimeManager view). Text only; statuses from what the session can read.

process_run_access

process_run_access(process_ids=None, user: Optional[str] = None) -> Dict[str, Any]

The GRANTs a user needs to run processes of the current store (process_ids None = all): the tables and catalog views, the process views, the manager views, and the rights the process views' databases need on what they read (from the persisted lineage). Text only; statuses from what the session can read.

write_access_script

write_access_script(plan: Dict[str, Any], out_path: Optional[str] = None, groups: Optional[Iterable[str]] = None) -> str

Write :func:access_script to out_path (default tdfs4ds_grants_<ts>.sql under tdfs4ds.SCHEDULING_SCRIPT_DIR or the working directory); return the path.

check_access

check_access(plan: Optional[Dict[str, Any]] = None, datasets: Optional[Iterable[str]] = None) -> Dict[str, Any]

Run as the target user, after the GRANTs were applied: EXPLAIN on each view (the plan's process, intermediate and dataset views at their target, or the current store's process views plus datasets). Refusals carry the GRANT that lifts them (:func:tdfs4ds.utils.query_management.grant_hint). Read-only, never raises: {ok, user, checked, refused, broken, unanswered}.

Submodules