Skip to content

tdfs4ds.utils.manager_settings

tdfs4ds.utils.manager_settings

Settings of a table of dates: FS_MANAGER_SETTINGS (0.3.7.31).

An optional key/value valid-time table, keyed on the TABLE OF DATES of a TimeManager (the soft clones of a clock share that table, so what belongs to the dates belongs here). First setting: CALENDAR, the JSON of the :class:tdfs4ds.utils.calendar.Calendar rule that produced the dates. The data_domain_settings pattern: created at setup() / connect() when missing, a failed CREATE is one warning remembered and not retried, every INSERT names its columns, reads are fail-open (no table = no setting).

CALENDAR module-attribute

CALENDAR = 'CALENDAR'

SETTING_NAME_LEN module-attribute

SETTING_NAME_LEN = 100

SETTING_VALUE_LEN module-attribute

SETTING_VALUE_LEN = 4000

_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.

_table_name

_table_name() -> str

_qualified_table

_qualified_table() -> str

_key

_key() -> Optional[str]

reset_state

reset_state() -> None

_warn_once

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

_execute

_execute(sql: str)

manager_settings_ddl

manager_settings_ddl() -> str

manager_settings_creation

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

Create FS_MANAGER_SETTINGS when missing. Never raises; returns whether it is usable.

available

available() -> bool

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

_raw

_raw(name) -> str

_where

_where(table_db: str, table: str) -> str

read_settings_sql

read_settings_sql(table_db: str, table: str) -> str

upsert_setting_sql

upsert_setting_sql(table_db: str, table: str, name: str, value: str) -> str

delete_setting_sql

delete_setting_sql(table_db: str, table: str, name: str) -> str

read_manager_settings

read_manager_settings(table_db: str, table: str) -> Dict[str, str]

{SETTING_NAME: SETTING_VALUE} of a table of dates. Fail-open: no table, no row or an unreadable table is an empty dict.

set_manager_setting

set_manager_setting(table_db: str, table: str, name: str, value: str, *, dry_run: bool = False) -> str

Record (or change) one setting of a table of dates; returns the SQL. dry_run=True writes nothing. Raises RuntimeError when the table is missing and cannot be created.

delete_manager_setting

delete_manager_setting(table_db: str, table: str, name: str, *, dry_run: bool = False) -> str

delete_table_settings_sql

delete_table_settings_sql(table_db: str, table: str) -> str

Delete every setting of a table of dates (its calendar rule included).

delete_table_settings

delete_table_settings(table_db: str, table: str, *, dry_run: bool = False) -> str

Forget every setting of a table of dates, for a table that is dropped (0.3.7.31). Fail-open: no settings table, or an error, deletes nothing and is only logged at debug level.