tdfs4ds.migration.calendars¶
tdfs4ds.migration.calendars
¶
Calendar rules and recorded gaps travel with a migrated clock (0.3.7.31).
A table of dates keeps the rule that produced it in FS_MANAGER_SETTINGS (setting
CALENDAR), and a domain clock keeps the dates a catch_up='latest' refresh skipped in
FS_DATA_DOMAIN_SETTINGS (setting CALENDAR_GAPS). The source store is read by explicit
schema, never through federation; the primary is written. Statement builders are pure; the
readers are fail-open (a source from before 0.3.7.31 has neither table).
norm_name
¶
Uppercase, de-quoted, stripped — the canonical comparison form.
target_domain_for
¶
The target data domain of source_domain under target_data_domain mapping. Pure.
None (or '') keeps the source domain; a string sends every domain there; a dict
{source_domain: target_domain} is looked up case-insensitively, '*' standing for
any other domain, and a domain it does not name keeps its own name.
quote_ident
¶
Return name as a Teradata identifier, quoting it only if required.
Idempotent: an already-quoted name is returned unchanged rather than being
wrapped a second time. Embedded quotes are escaped as "".
Parameters¶
name : str
The raw object/database name.
force : bool, default False
Quote even when the name does not need it. Use only at the few sites
that have always emitted unconditional quotes and whose exact output is
already baked into persisted DDL (see
feature_store/feature_query_retrieval.py) — elsewhere forcing would
change the SQL of existing stores for no reason.
sql_literal
¶
Escape value for use inside a single-quoted SQL string literal.
For the DBC probes and catalog predicates that compare a name as data
(WHERE DatabaseName = '…'). The caller supplies the surrounding quotes.
read_source_calendars
¶
[{table_database, table, value}]: the CALENDAR rows of the source store. Fail-open.
read_source_previous
¶
[{table_database, table, value}]: the PREVIOUS settings (previous-date views, 0.3.7.31) of the
source store. Fail-open.
read_source_gaps
¶
The CALENDAR_GAPS value (JSON text) of a source domain, or None. Fail-open.
calendar_items
¶
calendar_items(plan: Dict[str, Any], placement: Dict[Tuple[str, str], Tuple[str, str]], target_domain: Optional[str], source_calendars: List[Dict[str, str]], clock_tables: Optional[Dict[str, Tuple[str, str]]] = None, source_previous: Optional[List[Dict[str, str]]] = None) -> Dict[str, List[Dict[str, Any]]]
Pure. What is copied: {'calendars': [{source, target: (db, table), value}],
'gaps': [{data_domain, value}]}.
A source table of dates is copied when it was migrated (its placement) or is the table of
a migrated domain clock (clock_tables {target domain: (db, table)}, filled by the clock
step). Gaps come from plan['domain_clocks'] (gaps, read at planning time) and are
re-keyed on the target data domain.
calendar_statements
¶
Pure: the statements that write items in the primary.
copy_calendars
¶
copy_calendars(plan, placement, target_domain, src, clock_tables, report, emit, *, dry_run: bool = False) -> List[str]
Write the calendar rules and gaps of the migrated clocks in the primary and return the
statements. Fail-open: a failure is reported in report['calendars'] and never stops the
migration. With dry_run=True nothing is written.
clock_previous_statement
¶
Pure: the REPLACE VIEW of the previous-date view of a migrated clock (0.3.7.31), over its placed
table, from the PREVIOUS setting copied with the calendar; None when the source had none. The previous
views of the processes' soft clones are ordinary views of the migration (the process views read them).