Skip to content

tdfs4ds.feature_props.store

tdfs4ds.feature_props.store

Storage of feature properties: two optional objects, created by the FIRST declaration.

  • FS_FEATURE_PROPERTIES (valid time, PI DATA_DOMAIN, ENTITY_NAME, FEATURE_NAME) + view FS_V_FEATURE_PROPERTIES: one row per feature (and optionally per process), every property a nullable column; NULL = "no rule", never a default.
  • FS_FEATURE_ALLOWED_VALUES (valid time, same key + PROCESS_ID, ALLOWED_VALUE) + view.

Nothing here runs unless a feature property is declared: setup() and connect() never create these tables (connect() only notes whether they exist, from the read it already makes). Every builder is pure; create_tables is the only writer.

PROPERTY_COLUMNS module-attribute

PROPERTY_COLUMNS = ['DATA_DOMAIN', 'ENTITY_NAME', 'FEATURE_NAME', 'PROCESS_ID', 'VALID_MIN', 'VALID_MAX', 'NULLABLE', 'NULL_MEANING', 'SENSITIVE', 'SENSITIVITY_REASON', 'AUTHOR', 'DB_USER']

_TABLE_OPTIONS module-attribute

_TABLE_OPTIONS = 'FALLBACK,\n        NO BEFORE JOURNAL,\n        NO AFTER JOURNAL,\n        CHECKSUM = DEFAULT,\n        DEFAULT MERGEBLOCKRATIO'

_VALID module-attribute

_VALID = 'ValidStart TIMESTAMP(0) WITH TIME ZONE NOT NULL,\n            ValidEnd   TIMESTAMP(0) WITH TIME ZONE NOT NULL,\n            PERIOD FOR ValidPeriod (ValidStart, ValidEnd) AS VALIDTIME'

_LATIN module-attribute

_LATIN = 'CHARACTER SET LATIN NOT CASESPECIFIC'

_UNICODE module-attribute

_UNICODE = 'CHARACTER SET UNICODE NOT CASESPECIFIC'

sql_literal

sql_literal(value)

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.

properties_name

properties_name() -> str

allowed_name

allowed_name() -> str

view_of

view_of(name: str) -> str

table_sql

table_sql(name: str) -> str

view_sql

view_sql(name: str) -> str

entity_text

entity_text(entity) -> str

The ENTITY_NAME text of the feature catalog: the entity columns, upper-cased, sorted.

lit

lit(value) -> str

A SQL literal (NULL for None / empty).

properties_ddl

properties_ddl() -> str

allowed_ddl

allowed_ddl() -> str

view_ddl

view_ddl(name: str, temporal: bool) -> str

comment_sql

comment_sql(name: str, text: str) -> str

object_specs

object_specs() -> list

[(label, create, follow_up)] of the two objects, tables before views.

create_tables

create_tables() -> List[str]

Create the two objects when missing (idempotent). Returns the labels created. Raises the database error of a real failure; marks the properties as present.

_in

_in(values: Iterable[str]) -> str

qualifier

qualifier(as_of_literal: Optional[str]) -> str

CURRENT VALIDTIME or VALIDTIME AS OF TIMESTAMP '...' (the literal body).

properties_read_sql

properties_read_sql(features=None, data_domains=None, as_of_literal=None) -> str

allowed_read_sql

allowed_read_sql(features=None, data_domains=None, as_of_literal=None) -> str

catalog_read_sql

catalog_read_sql(as_of_literal: Optional[str] = None) -> str

The registered features with their stored type and storage table (primary store).

process_cond

process_cond(alias: str, process_id) -> str

_key_where

_key_where(decl: dict, alias: str = '') -> str

upsert_sql

upsert_sql(decl: dict, author: Optional[str]) -> str

Declare (or replace) the properties of one feature: the current row is closed at the current valid time and a new one opened (CURRENT VALIDTIME UPDATE ... ELSE INSERT). Every column is named; a property absent from decl is NULL = no rule.

delete_allowed_sql

delete_allowed_sql(decl: dict) -> str

insert_allowed_sql

insert_allowed_sql(decl: dict, value: str) -> str

end_rows_sql

end_rows_sql(triplets: Iterable[tuple]) -> List[str]

Statements ending the declared properties and allowed values of removed features ([(feature, data_domain, entity_text)]). The valid-time history keeps what was declared: only the current rows end.

count_rows_sql

count_rows_sql(triplets: Iterable[tuple]) -> str

Current property rows of features ([(feature, data_domain, entity_text)]).