tdfs4ds.dataset.history_versions¶
tdfs4ds.dataset.history_versions
¶
Which process versions computed the values of a history (0.3.3.12).
A feature's stored values all carry its process's PROCESS_ID, whatever SQL
computed them. The SQL beneath a process changes over time: its process version,
kept in FS_PROCESS_SQL. A version is stamped at the valid time the process
writes its values at (FEATURE_STORE_TIME under a TimeManager or a roll_out,
the run's real-time pin otherwise), the same valid time as the catalog row and as
the values themselves. So the version that computed a stored value is simply the
version in force at the value's ValidStart.
- :func:
version_segments(pure): version periods ->[{version, from, to}]over a window, with the time before the first version asNone("before versioning", never a guessed version). - :func:
history_versions: per feature of a dataset (or for process ids), the versions inside a window. - :func:
history_with_versions: a companion view<view>_PV= the history plus a<feature>_PROCESS_VERSIONcolumn per feature. The dataset view itself is never changed (backward compatibility).
qualified
¶
Build db.obj with each part quoted only as needed.
qualified('TDB', 'FS_X') == 'TDB.FS_X' (unchanged for ordinary names);
qualified('SVC@CORP', 'FS_X') == '"SVC@CORP".FS_X'. An empty/None
database yields the bare object name, so unqualified callers keep working.
force=True quotes both parts unconditionally — only for the sites that
have always emitted quotes and whose exact text is already persisted (dataset
view DDL, returned volatile-table names).
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.
version_periods_sql
¶
The valid-time periods of every version of the processes (one row each).
version_segments
¶
[{"version", "from", "to"}] along valid time, for one process.
periods: dicts PROCESS_VERSION, VALIDSTART, VALIDEND. Adjacent
periods of one version merge; the time before the first period is None
(before versioning). Clipped to [start, end); from None = from the
beginning, to None = still open.
_window_bounds
¶
(start, end) of a HistoryWindow, evaluated in the database now.
history_versions
¶
The process versions behind a history, per feature (or per process).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
Optional[str]
|
a historical dataset view ( |
None
|
process_ids
|
instead of a dataset, |
None
|
|
start, end
|
the window (default: the dataset's, else everything). |
required |
Returns {label: {"process_id", "segments": [{"version", "from", "to"}],
"versions": [...]}}; a version None is "before versioning".
describe_versions
¶
One line per feature whose history spans several process versions.
history_with_versions
¶
history_with_versions(dataset: str, view_name: Optional[str] = None, *, replace: bool = False, return_query: bool = False)
Create <view>_PV: the history plus <feature>_PROCESS_VERSION per feature.
Each period gets the process version in force at its ValidStart (NULL
before versioning). The dataset view is read as is and never changed.