Skip to content

tdfs4ds.serve.report_batch

tdfs4ds.serve.report_batch

The statements the Overview report sends, listed so they can be read in grouped requests (0.3.8.2).

The report reads 5 catalogs, the follow-up log, the lineage rows, the manager registry, the dictionary of the storage tables and one date per manager: dozens of small SELECTs, each a round trip (0.3 to 0.5 s on a remote link). Here the SAME statements the readers will send are built (each reader exposes its SQL: lineage_rows_sql, manager_index_sql, read_registry_sql, dictionary_statements, time_read_statements, ...), and :func:tdfs4ds.utils.grouped_read.prefetch reads them in two requests:

  • R1 (needs nothing): the five catalog reads and the feature history, the follow-up log of the registered processes (a sub-select, so it needs no id list), the lineage rows, the process catalog's managers and the manager registry.
  • R2 (needs R1's answer): the dictionary of the storage tables and of the registered views, the settings of each data domain, and the date and calendar of each manager.

Nothing here changes what a reader returns: a statement not predicted exactly runs by itself, as before. With read-only stores attached, a replaced catalog accessor or a replaced _query_df (tests, user code) nothing is prefetched, because the readers then take other paths.

logger_safe

logger_safe(level, message, *args, **kwargs)

Wrapper around the global logger that only emits logs when tdfs4ds.DISPLAY_LOGS is True. level is a string like "info", "error", etc.

applicable

applicable() -> bool

True when the readers are the plain single-store ones whose SQL is listed here.

follow_up_sql

follow_up_sql() -> str

The follow-up log of the registered processes, as one statement (no id list: a sub-select of the process catalog, which is also what the report's id list was read from).

first_statements

first_statements(as_of_literal) -> list

R1: the statements read before anything is known ([] when nothing can be predicted).

_u

_u(v) -> str

_manager_keys

_manager_keys(proc_df, graph) -> set

{(DB, OBJECT)} of every manager view and table of dates the time drivers will read.

third_statements

third_statements(proc_df, graph) -> tuple

R3: (statements, absent): the date of each manager and the calendar of each table of dates that EXIST (R2 said which), and the statements on objects that do not (never sent).

A manager read apart because a view whose table was dropped fails, and one failing statement fails its whole request. A view that exists but whose table is gone still fails: the request then splits (see :func:tdfs4ds.utils.grouped_read.run_grouped).

second_statements

second_statements(snapshot, graph, proc_df, *, current: bool, time_graph=None) -> list

R2: what depends on R1 and cannot fail (the dictionary, the domains' settings, and which manager objects exist, which gates R3).

current: the report is at the current valid time (then the dictionary of the storage tables is listed too). time_graph: the CURRENT lineage graph the time drivers read (the managers, their dates and the domain settings are always read as they are now); None = graph.

prefetch_inputs

prefetch_inputs(stack, as_of=None, extra=None)

R1, R2 and R3 for a page that reads what the report reads (0.3.8.2): the catalogs, the lineage, the managers and their dates, the dictionary. Returns {"snapshot", "graph", "processes"} (the snapshot is the shared, cached one). stack: a contextlib.ExitStack that keeps the rows available until it closes. extra: f(snapshot, processes) -> [statements] added to R2 (what only that page reads). Nothing is prefetched when :func:applicable is false.