Skip to content

tdfs4ds.dataset.time_links

Which TimeManager each dataset follows, and how it stands with the domain clocks (0.3.7.19).

A dataset built with build_dataset(time_manager=...) reads the business date of one manager. That manager can be the clock of a data domain (the one people move), a soft clone of a clock (a process's own cursor on the same dates, moved by roll_out), or a manager unrelated to any clock. The distinction matters: tm.update(i) on the clock does not move a clone, so a dataset on a clone shows another date until the next roll-out.

Layers: :func:manager_relation is pure; :func:dataset_time_managers reads (one read of the dataset build table, one of the domain settings, one of the manager registry).

RELATION_TEXT module-attribute

RELATION_TEXT = {CLOCK: 'the clock of data domain {domain}', CLONE: 'a soft clone of the clock {clock} of data domain {domain}: same dates, its own cursor (moved by roll_out, not by tm.update on the clock)', OWN: "a TimeManager on no domain clock's dates"}

_node

_node(db, name) -> str

manager_relation

manager_relation(db: str, view: str, clocks: Iterable[Dict], tables: Optional[Dict[str, str]] = None, table: Optional[str] = None) -> Dict

How the manager db.view stands with clocks (pure).

clocks: [{data_domain, database, view, table_database, table}]. tables: {view_node: table_node} from the manager registry (a soft clone may read a table in another database). table: the manager's table name when known (default <view>_HIDDEN in db). Returns {relation, clock, data_domain, text}; relation is clock, clone or own.

all_domain_clocks

all_domain_clocks() -> List[Dict]

Every data domain's clock, [{data_domain, database, view, table_database, table}]. One read; fail-open [] (no settings table, an older store, an unreadable one).

_registry_tables

_registry_tables() -> Dict[str, str]

build_rows_sql

build_rows_sql() -> str

describe_rows

describe_rows(rows, clocks, tables=None) -> List[Dict]

One dict per dataset from build-table rows (pure).

dataset_time_managers

dataset_time_managers(datasets: Optional[Iterable[str]] = None) -> List[Dict]

Which TimeManager each registered dataset follows, and how it stands with the clocks.

One dict per dataset: dataset ('db.name'), time_mode (CURRENT / AS_OF / TIME_MANAGER / HISTORY, None when the dataset has no build row: built before 0.3.1.216), time_manager ('db.view'), relation (clock = a domain clock, clone = a soft clone of one, own = on no clock's dates, None without a manager), clock and data_domain of the clock concerned, text, grouped, join_type. datasets: names ('name' or 'db.name') to keep; None = all.

To make a dataset on a clone follow the clock itself: tdfs4ds.rebuild_dataset('db.ds', time_manager='<clock db.view>', replace=True). Primary store only. Fail-open: [] when the catalog cannot be read.