tdfs4ds.deploy.export¶
tdfs4ds.deploy.export
¶
export_definitions: write the DEFINITIONS of a part of a feature store as versionable files
(0.3.8.15). Read-only on the source store.
Definitions are migrated, state is not: the bundle holds processes (view SQL + options), datasets
(the frozen selection), upstream / downstream / attached views, manager STRUCTURE, data-domain
clocks and settings, documentation, glossary, feature properties and the physical characteristics
of the storage. It never holds feature values, follow-up rows, the vector index, nor (unless
with_manager_contents=True) the dates and segments of the managers.
Variables
¶
Database -> variable assignment for one source store.
table_db / view_db: the store's databases. rename: {default name or source
database: new variable name}. name_for(db, is_table) gives the variable of a database;
when the store is not split, tables get FS_DB and views FS_VIEW_DB (both hold the same
value in the source, possibly different ones in a target).
__init__
¶
logger_safe
¶
Wrapper around the global logger that only emits logs when
tdfs4ds.DISPLAY_LOGS is True. level is a string like "info", "error", etc.
norm_name
¶
Uppercase, de-quoted, stripped — the canonical comparison form.
split_qualified
¶
Split 'db.obj' / '"db"."obj"' / 'obj' into (db, obj) (raw,
de-quoted but original case preserved). db is '' when unqualified.
write_text
¶
Write text UTF-8 with LF line ends; parents created. Returns the path.
fingerprint
¶
The fingerprint of a definition (None for None). Pure.
_plan_managers
¶
{(kind, DB, VIEW): {database, view, table_database, table, used_by: [pid], clock_of: [domain]}}.
_downstream_requirements
¶
_downstream_requirements(objects: Dict[str, Any], variables: Variables) -> Dict[Tuple[str, str], Dict[str, Any]]
{(db, obj): {kind}} of the objects outside the store that an exported DOWNSTREAM view reads and
that the plan did not inventory (0.3.8.15): the planner walks upstream of the processes only, so a
downstream view joining an outside table left that table out of requires, and the target learnt of
its absence only when the apply failed on the view (live, other system). Pure.
collect_export_inputs
¶
collect_export_inputs(plan: Dict[str, Any], variables: Variables, *, with_manager_contents: bool = False) -> Dict[str, Any]
Everything the definitions need, read from the source store (the only I/O of an export).
source_namer
¶
The :class:~tdfs4ds.deploy.model.Namer of the source store of plan.
definitions_from_plan
¶
definitions_from_plan(plan: Dict[str, Any], inputs: Dict[str, Any], variables: Variables) -> List[Dict[str, Any]]
Every definition of the bundle, in deployment order. Pure.
target_environment
¶
target_environment(plan: Dict[str, Any], values: Dict[str, str], domains: List[str]) -> Optional[Dict[str, Any]]
The target values of a migration plan, as an environment: {variables, domain_map}, or
None when the plan names no target database. Pure.
FS_DB / FS_VIEW_DB take the plan's target table / view database; any other variable
the database the plan's database_map gives its source database (any object kind), else
the one its objects are placed in when they all agree, else its own (an outside database read
where it is). Data domains follow domain_map / target_data_domain.
render_bundle
¶
render_bundle(plan: Dict[str, Any], defs: List[Dict[str, Any]], variables: Variables, *, exported_at: Optional[str] = None, outside_objects: str = 'keep', with_manager_contents: bool = False, conflict_policy: Optional[str] = None, target_env: bool = False) -> Dict[str, str]
{relative path: text} of every file of the bundle except report.html. Pure.
conflict_policy: the text of an existing conflict_policy.yaml to keep (the reviewer's
decisions); None = the default policy. target_env: also write
environments/target.yaml with the plan's target databases and data domains
(:func:target_environment); skipped when the plan names no target.
export_definitions
¶
export_definitions(path, *, seeds=None, data_domains=None, include_downstream: bool = False, outside_objects: str = 'keep', with_manager_contents: bool = False, source=None, variables: Optional[Dict[str, str]] = None, plan: Optional[Dict] = None, report: bool = True, target_environment: bool = False) -> Dict[str, Any]
Write the definitions of a part of a feature store under path (read-only on the store).
Parameters¶
path : str
Folder of the bundle (created). Existing files of the bundle are rewritten, except
conflict_policy.yaml, which holds the reviewer's decisions and is kept when present (delete it
to get the default policy back); nothing else in the folder is touched.
seeds : list[str] | None
Processes (id or view), datasets or features to export, with everything upstream of them
(plan_migration's closure). None with data_domains=None = the whole store.
data_domains : list[str] | None
Export these data domains whole.
include_downstream : bool
Also export the views (and attached views) that read the exported processes and datasets.
outside_objects : 'keep' | 'move'
Objects of databases outside the store: 'keep' (default) lists them in requires (checked
on the target, never created); 'move' exports their definition to be created.
with_manager_contents : bool
Also bundle the dates of the TimeManagers and the rows of the FilterManagers. Loaded by a
deployment only into a manager that is absent or empty. Use it to back up a data domain.
source : str | dict | None
The store to export: None = the active store; else another store readable on the same system
(attached read-only for the export).
variables : dict | None
Rename variables: {default name or source database: new name}, e.g. {'FS_DB': 'STORE_DB'}.
plan : dict | None
A plan_migration result to export instead of planning here.
report : bool
Write report.html (the migration report of the export plan).
target_environment : bool
Also write environments/target.yaml holding the plan's target databases and data
domains (the mapping typed in the app's Migration panel, or plan's database_map /
target_data_domain). Nothing is written when the plan names no target database.
Returns¶
dict
{path, files: [relative paths], objects: n, by_kind: {kind: n}, variables, errors}.