tdfs4ds.feature_store.placement¶
tdfs4ds.feature_store.placement
¶
Where a feature is stored: FS_FEATURE_PLACEMENT and the table tag (0.3.3.30).
By default every feature of one (data domain, entity, value type, primary index,
partitioning) lives in the same FS_T_* table, whichever process computes it.
That name is recomputed by register_features whenever it registers a feature (a new
one, or one whose type changed) and written over the catalog row, so editing
FEATURE_TABLE by hand moves no data and is undone by the next registration. A placement is therefore recorded, and the naming rule follows it:
``get_feature_store_table_name(..., table_tag='SALES')`` -> ``FS_T_<hash>__SALES``
The tag is appended to the historical name, never substituted for any part of it: value type, primary index and partitioning stay encoded as before.
Storage¶
FS_FEATURE_PLACEMENT (valid time, PRIMARY INDEX (DATA_DOMAIN, ENTITY_NAME,
FEATURE_NAME)): one row per feature triplet with its TABLE_TAG. The triplet is
known before the FEATURE_ID exists, so a new process can start in its own table.
The table is optional, like FS_PROCESS_OPTIONS: created at setup() and by
connect() when missing, a failed CREATE is one warning remembered for the store,
and a store without the table (or without a row) behaves exactly as before - one
cached existence check per store, no other statement.
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.
validate_tag
¶
The tag as stored (upper case). Raises ValueError for anything that is not a
plain identifier of at most 64 characters: it becomes part of a table name.
reset_state
¶
Forget what was learnt about the table (tests, setup(), connect()).
placement_creation
¶
Create FS_FEATURE_PLACEMENT when missing. Never raises.
existing is the lower-cased object set connect() read from DBC: a table found
there costs no CREATE. Returns whether the table is usable.
available
¶
Whether FS_FEATURE_PLACEMENT exists in the primary store (checked once per store).
entity_name_of
¶
The ENTITY_NAME of the catalog for an entity: its columns, sorted, comma-joined.
upsert_sql
¶
Record (or change) the placement of one feature. Every column is named.
read_tags
¶
{FEATURE_NAME upper-cased: TABLE_TAG} of one (data domain, entity).
Fail-open: no table, no row or an unreadable table is an empty dict, which is every feature in its historical table. The table is checked once per store, so a store that never used placements pays one cached query and nothing else.
read_all
¶
Every current placement: [{"data_domain", "entity", "feature", "tag", "since"}].
tag_of
¶
The tag of a feature in a :func:read_tags result (case-insensitive), or None.
record_placements
¶
Write the placement of feature_names (one statement per feature). Returns the count.
Raises RuntimeError when the table does not exist and cannot be created: a tag
that is not recorded would be forgotten by the next run.
prepare_storage_tag
¶
Record the placement of a new process's features. Returns None when done, else the reason it cannot be (the caller logs it and registers nothing).
A feature already placed under another tag, or already stored in a table that does not
carry this tag, is refused: placing it now would send its next values to a new table and
leave its history behind. relocate_features moves a feature with its history.
get_feature_placement
¶
The current placements: [{"data_domain", "entity", "feature", "tag", "since"}].
Empty when the store has no FS_FEATURE_PLACEMENT table or no row.