tdfs4ds.genai.valid_from¶
tdfs4ds.genai.valid_from
¶
Valid time of written documentation (0.3.7.34).
Documentation says what an object means, not what was true on the day it was typed. A
row written with CURRENT VALIDTIME is valid only from the write time on, so a read at
an earlier valid time (the domain clock's business date, a dataset built as_of, the
agent's as-of date) found no documentation at all. The valid start of a written part is
now chosen as follows. Metadata is valid in REAL time (CURRENT VALIDTIME at the write, first
load included); data (feature values) is valid in business time. The agent reads documentation
at the current time, so no backdating is needed:
- default:
CURRENT VALIDTIME; valid_from=(explicit opt-in, a date the caller gives; one name everywhere documentation is written): a part with no row yet starts at that date; a later change to a part that already has a row keepsCURRENT VALIDTIME.
clock_first_date and FIRST_LOAD_VALID_FROM remain available for explicit use
(backdate_documentation) but are not used by default.
Writes use the explicit period form VALIDTIME PERIOD '(t, UNTIL_CHANGED)' (the
ingestion MERGE's own); a plain sequenced INSERT does not fill the period (Error 3811).
Provenance and the activity log keep the write time: they record the act of writing.
Pure helpers first, then the one database read (the clock's first date). Never raises.
_VALID_FROM
module-attribute
¶
_DOMAIN
module-attribute
¶
normalise_valid_from
¶
None / '' -> None; else 'YYYY-MM-DD HH:MM:SS[.f]+HH:MM' (no offset = UTC). Pure.
Raises ValueError for a date that cannot be read (never guessed).
validtime_qualifier
¶
The temporal qualifier opening a MERGE / DELETE: CURRENT VALIDTIME or the explicit period. Pure.
open_end
¶
The valid end of an open first version written with explicit period columns, as SQL: the keyword
UNTIL_CHANGED (live: accepted as a ValidEnd value, reads back as a CURRENT VALIDTIME write's
9999-12-31 23:59:59+00:00), else the store's END_PERIOD timestamp. Pure.
first_version_insert_sql
¶
The INSERT of the FIRST version of parts, valid from valid_from until changed (pure).
A sequenced MERGE / INSERT does not fill the period columns (Error 3811, ValidStart is NOT NULL), so
the period is written explicitly: NONSEQUENCED VALIDTIME INSERT ... (cols, ValidStart, ValidEnd).
table: the qualified table; source_sql: a table name or a SELECT / ( ... ) giving columns
(the period columns are added). A change to a part that already has a row stays a
CURRENT VALIDTIME MERGE / UPDATE (its previous text becomes history).
choose_valid_from
¶
choose_valid_from(explicit: Optional[str], first_load: bool, clock_first: Optional[str]) -> Optional[str]
The valid start of a part (pure): the explicit valid_from= if given, else None =
CURRENT VALIDTIME (real time), first load included. first_load and clock_first are
kept for compatibility and ignored: metadata is valid in real time, data in business time.
split_first_load
¶
The keys with no row at all yet (pure). Keys compare upper-cased and unquoted.
documentation_valid_from
¶
Valid start of every documentation row written inside the block (valid_from=), and the
data domain whose clock gives the first-load date (default tdfs4ds.DATA_DOMAIN).
with_valid_from
¶
Decorator: the function accepts valid_from= (and data_domain_for_clock= is not needed:
the domain is the call's data_domain when it has one). The value is applied to every
documentation row written inside the call.
clock_first_date
¶
First date of the data domain's clock calendar as a valid-from text, or None (no domain, no clock, unreadable). Never raises.