Skip to content

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.

FORMAT_VERSION module-attribute

FORMAT_VERSION = 1

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).

table_db instance-attribute

table_db = table_db

view_db instance-attribute

view_db = view_db or table_db

rename instance-attribute

rename = {str(k): str(v) for k, v in (rename or {}).items()}

values instance-attribute

values: Dict[str, str] = {}

fs_db property

fs_db: str

fs_view_db property

fs_view_db: str

__init__

__init__(table_db: str, view_db: Optional[str] = None, rename: Optional[Dict[str, str]] = None)

name_for

name_for(db: str, is_table: bool = False) -> str

is_store_db

is_store_db(db: str) -> bool

logger_safe

logger_safe(level, message, *args, **kwargs)

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

norm_name(name: Optional[str]) -> str

Uppercase, de-quoted, stripped — the canonical comparison form.

split_qualified

split_qualified(name: Optional[str]) -> Tuple[str, str]

Split 'db.obj' / '"db"."obj"' / 'obj' into (db, obj) (raw, de-quoted but original case preserved). db is '' when unqualified.

dump_yaml

dump_yaml(obj: Any) -> str

obj as deterministic YAML text (ends with a newline).

write_text

write_text(path, text: str) -> str

Write text UTF-8 with LF line ends; parents created. Returns the path.

fingerprint

fingerprint(defn: Optional[Dict[str, Any]]) -> Optional[str]

The fingerprint of a definition (None for None). Pure.

_u

_u(x) -> str

_plan_managers

_plan_managers(plan) -> Dict[Tuple[str, str, str], Dict[str, Any]]

{(kind, DB, VIEW): {database, view, table_database, table, used_by: [pid], clock_of: [domain]}}.

_is_requirement

_is_requirement(o: Dict[str, Any], variables: Variables) -> bool

_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

source_namer(plan: Dict[str, Any], variables: Variables, extra_dbs=()) -> M.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.

_sha_text

_sha_text(text: str) -> str

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) -> 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.

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) -> 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).

Returns

dict {path, files: [relative paths], objects: n, by_kind: {kind: n}, variables, errors}.