tdfs4ds.deploy.model¶
tdfs4ds.deploy.model
¶
Object definitions of a deployment bundle (0.3.8.15). Pure: no database.
One builder per kind turns what was read from a store (catalog row, SHOW VIEW text, settings,
structure of a manager...) into the definition written to a YAML file, in placeholder form:
databases are {{VAR}}, processes are named by their view. Export (source store) and plan (target
store) use the same builders, so a definition read back from a target is comparable with the file.
_PLACEHOLDER_RE
module-attribute
¶
PHASES
module-attribute
¶
PHASES = {'requires': 0, 'table': 1, 'time_manager': 2, 'filter_manager': 2, 'domain': 3, 'view:upstream': 4, 'process': 4, 'dataset': 4, 'view:downstream': 6, 'glossary': 7, 'documentation': 8}
KIND_PREFIX
module-attribute
¶
KIND_PREFIX = {'process': 'process', 'dataset': 'dataset', 'view': 'view', 'table': 'table', 'time_manager': 'manager', 'filter_manager': 'manager', 'domain': 'domain', 'glossary': 'glossary', 'documentation': 'documentation', 'requires': 'requires'}
Namer
¶
Database -> variable mapping used to write names and SQL in placeholder form.
refs: {(DB, OBJ): VAR} (object level, wins); view_dbs / table_dbs: {DB: VAR}
(database level, for any other object of those databases, views and tables).
__init__
¶
__init__(refs: Dict[Tuple[str, str], str], view_dbs: Dict[str, str], table_dbs: Optional[Dict[str, str]] = None)
_ref_pattern
¶
Case/quote-tolerant regex matching a fully-qualified db.obj reference,
as a whole name (never a prefix or a suffix of a longer one).
split_qualified
¶
Split 'db.obj' / '"db"."obj"' / 'obj' into (db, obj) (raw,
de-quoted but original case preserved). db is '' when unqualified.
to_placeholders
¶
to_placeholders(text: str, refs: Dict[Tuple[str, str], str], db_fallback: Optional[Dict[str, str]] = None) -> str
text with every db.obj named in refs ({(DB, OBJ): VAR}, normalised keys) written
{{VAR}}.OBJ; then, with db_fallback ({DB: VAR}), any other db.<name> of those
databases. Whole qualified names only. Pure.
var_of
¶
'{{FS_VIEW_DB}}' -> 'FS_VIEW_DB' (a raw database name is returned as it is).
unclone_sql
¶
sql reading the domain clock instead of its soft clone (and their previous-date views).
time_relation
¶
'none' | 'clock' (the clock itself) | 'clone' (reads the clock's table of dates) |
'other'. Pure.
process_definition
¶
process_definition(row: Dict[str, Any], ddl: Optional[str], extras: Optional[Dict[str, Any]], clock: Optional[Dict[str, str]], namer: Namer, *, data_domain: Optional[str] = None, reads: Iterable[str] = (), wave: Optional[int] = None) -> Dict[str, Any]
A process definition from its catalog row (VIEW_NAME, ENTITY_ID, FEATURE_NAMES,
FOR_PRIMARY_INDEX, FOR_DATA_PARTITIONING, TIME_*, FILTER_*, METADATA...).
dataset_definition
¶
dataset_definition(db: str, name: str, data: Dict[str, Any], namer: Namer, to_view, data_domain: Optional[str] = None) -> Dict[str, Any]
data = sources.read_dataset (selected features keyed by process id); to_view maps a
process id to its placeholder view name.
view_definition
¶
view_definition(db: str, obj: str, ddl: str, namer: Namer, *, role: str = 'upstream', attached: bool = False, data_domains: Iterable[str] = (), reads: Iterable[str] = ()) -> Dict[str, Any]
table_definition
¶
manager_definition
¶
manager_definition(kind: str, db: str, view: str, info: Optional[Dict[str, Any]], namer: Namer, *, table_db: Optional[str] = None, table: Optional[str] = None, used_by: Iterable[str] = (), clock_of: Iterable[str] = ()) -> Dict[str, Any]
domain_definition
¶
domain_definition(name: str, clock: Optional[Dict[str, str]], settings: Dict[str, str], properties: List[Dict[str, Any]], namer: Namer, to_view) -> Dict[str, Any]
documentation_definition
¶
documentation_definition(db: str, obj: str, doc: Dict[str, Any], namer: Namer, object_kind: Optional[str] = None) -> Dict[str, Any]
requires_definition
¶
dependency_order
¶
Definitions in deployment order: by phase, then (views, processes) each after what it reads within the bundle, then by key. Pure, deterministic; a cycle keeps the key order.