Skip to content

tdfs4ds.process_store.process_settings

tdfs4ds.process_store.process_settings

Per-process settings: FS_PROCESS_SETTINGS (0.3.3.30).

A key/value valid-time table, PRIMARY INDEX (PROCESS_ID), for the options of a process that change how run() executes it and that are not in FS_PROCESS_OPTIONS. The first one is TRACK_ENTITY_REFRESH (see feature_store/entity_refresh.py).

Why a second table, and why key/value:

  • FS_PROCESS_OPTIONS is written by older clients with a column-less positional ELSE INSERT INTO ... ('pid', 'flag'): adding a column to it would make every older client's close_absent_entities=True fail with Error 3812 (the FS_FOLLOW_UP lesson). It stays exactly as it is, and read_process_options merges both tables.
  • A later option is a new SETTING_NAME, not a new column: no DDL, ever. Every INSERT here names its columns.

The table is optional, like FS_PROCESS_OPTIONS: created at setup() and by connect() when missing; a failed CREATE is one warning, remembered and not retried in this process. A missing table or row reads as "every setting at its default".

TRACK_ENTITY_REFRESH module-attribute

TRACK_ENTITY_REFRESH = 'TRACK_ENTITY_REFRESH'

DATASET_TIME_MANAGER module-attribute

DATASET_TIME_MANAGER = 'DATASET_TIME_MANAGER'

DATASET_VIEW_NAME module-attribute

DATASET_VIEW_NAME = 'DATASET_VIEW_NAME'

DATASET_GROUPED module-attribute

DATASET_GROUPED = 'DATASET_GROUPED'

VALID_TIME_COLUMN module-attribute

VALID_TIME_COLUMN = 'VALID_TIME_COLUMN'

FORCE_VARCHAR_LENGTH module-attribute

FORCE_VARCHAR_LENGTH = 'FORCE_VARCHAR_LENGTH'

DEFAULT_VARCHAR_LENGTH module-attribute

DEFAULT_VARCHAR_LENGTH = 1024

SETTING_NAME_LEN module-attribute

SETTING_NAME_LEN = 100

SETTING_VALUE_LEN module-attribute

SETTING_VALUE_LEN = 1000

_STATE module-attribute

_STATE: dict = {}

_WARNED module-attribute

_WARNED: set = set()

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.

read_dataset_view

read_dataset_view(process_id: str)

(dataset_view_name, grouped) recorded for process_id, or None. Fail-open.

read_varchar_length

read_varchar_length(process_id: str)

The VARCHAR rounding of process_id: the recorded value, None when it records exact lengths, DEFAULT_VARCHAR_LENGTH when nothing is recorded (a process registered before 0.3.5.1 by upload_features, whose default was 1024). Fail-open to the default.

varchar_length_value

varchar_length_value(force_varchar_length) -> str

The text recorded for a force_varchar_length argument.

_table_name

_table_name() -> str

_qualified_table

_qualified_table() -> str

_key

_key() -> Optional[str]

reset_state

reset_state() -> None

Forget what was learnt about the table (tests, setup(), connect()).

_warn_once

_warn_once(key: str, message: str, *args) -> None

_execute

_execute(sql: str)

process_settings_ddl

process_settings_ddl() -> str

process_settings_creation

process_settings_creation(existing: Optional[Iterable[str]] = None) -> bool

Create FS_PROCESS_SETTINGS 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

available() -> bool

Whether FS_PROCESS_SETTINGS exists in the primary store (checked once per store).

read_settings_sql

read_settings_sql(process_id: str) -> str

upsert_setting_sql

upsert_setting_sql(process_id: str, name: str, value: str) -> str

Record (or change) one setting. Every column is named.

switch_off_sql

switch_off_sql(process_id: str, name: str) -> str

Set an existing setting to 'N'; a no-op when the process has no row.

delete_settings_sql

delete_settings_sql(process_id: str, purge: bool = True) -> str

_flag

_flag(value) -> str

read_settings

read_settings(process_id: str) -> Dict[str, str]

{SETTING_NAME: SETTING_VALUE} of process_id. Fail-open: no table, no row or an unreadable table is an empty dict (every setting at its default).

read_flag

read_flag(process_id: str, name: str) -> bool

record_setting

record_setting(process_id: str, name: str, value) -> bool

Record one setting (True / False are stored as Y / N).

A truthy flag writes the row (creating the table when it is missing, raising RuntimeError when it cannot be). False only switches off an existing row and is skipped when the table does not exist, so a store that never uses a setting gets no row.

remove_process_settings

remove_process_settings(process_id: str, purge: bool = True) -> str