tdfs4ds.workflow_assessment¶
tdfs4ds.workflow_assessment
¶
Workflow assessment: is the pipeline well built? (0.3.3.25)
store_consistency answers "do the catalogs and the storage line up?". This
module answers a different question: is the workflow well implemented?
- Entity keys (area
entity). Users often put every id column they know intoentity_id. A column the others determine splits nothing, yet it widens the primary index of every storage table, so a lookup by the real key cannot use it, and an attribute that changes over time starts a new entity at each change. The scan counts distinct key tuples in the storage tables, over the whole history and now, with each column left out in turn. - Order and synchronisation (area
time). Did every process run after the processes it reads, at each business date? Do the two ends of a dependency follow the same TimeManager? Is a TimeManager-driven process reading a dataset that does not move with its valid time (point-in-time leakage)? - Runs (area
runs). FilterManager segments missing or failed at the latest date, hollow runs (COMPLETED,0 rows), rows stuck at RUNNING. - Process SQL (area
process). Live SQL that differs from the stored version, and histories computed under several versions. - Storage (area
storage). Primary-index skew, entity columns typed differently across tables, entity keys contained in other ones.
Three layers, like the other report sections: :func:collect_workflow_inputs
is the only I/O, :func:build_workflow_model is pure, :func:render_workflow_html
returns HTML. :func:assess_workflow runs the first two.
Rules:
- No LLM. Every check is a count, a dictionary read, a graph walk or a hash comparison; every text is a fixed template. A test guards the imports.
- Every finding names its fix and nothing here runs it.
- A check that cannot run is listed in
unverifiablewith its reason; it is never reported as passing. - A dependency between entity columns is observed in the data, never a rule: the finding says so and asks for the business to confirm.
- Primary store only.
DBC_FULL_WHY
module-attribute
¶
DBC_FULL_WHY = 'Database DBC, the data dictionary, has no room left. Every DDL statement and every write to the catalogs (registration, documentation, lineage, follow-up) needs room in it, so the same fault shows in calls unrelated to its cause. The usual culprits are the query-log tables (DBC.DBQLogTbl, DBC.DBQLExplainTbl and others) and a large DBC.TransientJournal, which an open transaction keeps growing.'
DBC_FULL_FIX
module-attribute
¶
DBC_FULL_FIX = 'Only an administrator can fix it: purge the query-log tables, end the transaction holding the transient journal (ABORT SESSION), or give DBC more space. Nothing tdfs4ds can do from here frees it.'
AREAS
module-attribute
¶
AREAS = ['lineage', 'entity', 'time', 'runs', 'refresh', 'process', 'documentation', 'metadata', 'storage', 'values']
AREA_TITLES
module-attribute
¶
AREA_TITLES = {'lineage': 'Lineage integrity', 'entity': 'Entity keys', 'time': 'Order and synchronisation', 'runs': 'Runs and segments', 'refresh': 'Refresh by run() and roll_out()', 'process': 'Process SQL', 'documentation': 'Documentation and glossary', 'metadata': 'Metadata valid time', 'storage': 'Storage layout', 'values': 'Feature values and sensitivity'}
WORKFLOW_KIND_LABELS
module-attribute
¶
WORKFLOW_KIND_LABELS = {'redundant_key_column': 'Entity column determined by the other key columns', 'key_column_changes_over_time': 'Entity column that changes over time', 'entity_key_superset': 'Entity key containing another entity key', 'entity_column_type_mismatch': 'Entity column typed differently across tables', 'storage_skew': 'Storage table skewed across AMPs', 'entity_pi_inconsistent': 'Storage tables of one entity with different primary indexes', 'pi_not_aligned_with_source': 'Primary index not aligned with the largest source', 'partition_not_aligned_with_source': 'Partitioning not aligned with the largest source', 'segments_rescan_source': 'FilterManager segments each reading the whole source', 'segment_filter_defeats_pruning': 'Segment filter on the partitioning column that the SQL keeps from pruning', 'time_filter_by_join': 'TimeManager read through a join instead of a scalar filter', 'time_filter_not_scalar': 'TimeManager read in another form than a scalar filter', 'segment_filter_by_join': 'FilterManager read through a join instead of a scalar filter', 'segment_filter_not_scalar': 'FilterManager read in another form than a scalar filter', 'segment_filter_off_hierarchy': "FilterManager skipping a higher level of the source's partitioning", 'time_filter_not_on_partitioning': 'Business date compared with a column the source is not partitioned on', 'time_filter_defeats_pruning': 'Business-date filter on the partitioning column that the SQL keeps from pruning', 'partitioned_source_read_whole': 'Partitioned source read whole by the plan', 'source_without_statistics': 'Large source table with no statistics', 'fs_partition_not_on_filter': 'Storage tables not partitioned on the segmentation columns', 'date_computed_before_earlier_date': 'Business date computed before an earlier date of the same process', 'dbc_nearly_full': 'Database DBC nearly full', 'glossary_valid_in_future': 'Glossary term valid from a future time', 'documentation_valid_in_future': 'Documentation valid from a future time', 'metadata_valid_in_future': 'Catalog rows valid from a future time', 'registry_orphan': 'TimeManager left in the registry, its table gone', 'calendar_table_missing': 'TimeManager table of dates missing', 'documentation_low_confidence': 'Generated documentation written without documented sources', 'documentation_can_be_improved': 'Generated documentation that a better-documented input can improve', 'generated_contradicts_human': 'Generated documentation that contradicts human text', 'documentation_confidence_not_recorded': 'Generated documentation whose confidence was not recorded', 'clock_behind': 'Domain clock behind its calendar rule', 'calendar_rule_inferable': 'TimeManager calendar: a rule can be stored', 'calendar_irregular': 'TimeManager calendar follows no rule', 'calendar_off_rule_dates': 'TimeManager dates that do not fit the stored rule', 'hand_written_window': 'Window written by hand from the TimeManager', 'window_mismatch_calendar': "Window that does not match the calendar's step", 'fixed_window_bound': 'Window with a fixed literal lower bound', 'calendar_gap': 'Business dates skipped by a catch-up (recorded gap)', 'ran_before_upstream': 'Process started before its upstream had finished', 'upstream_recomputed_after': 'Upstream recomputed after the process ran', 'upstream_missing_at_date': "Upstream not computed at the process's business date", 'completed_on_failed_upstream': 'Process completed on a failed upstream', 'completed_on_empty_upstream': 'Process completed on an upstream that wrote 0 rows', 'ahead_of_upstream': 'Process ahead of its upstream in business time', 'mixed_time_modes': 'Dependency between real time and a TimeManager', 'different_time_drivers': 'Dependency between two independent TimeManagers', 'process_not_on_domain_clock': 'Process of a data domain not on the domain clock', 'reference_process_left_out': 'Reference process left out of the domain roll-out', 'rollout_refused': 'roll_out of a data domain refuses: a manager on other dates', 'rollout_no_single_calendar': 'No single roll_out covers the data domain', 'manager_shared_across_domains': 'TimeManager read by several data domains', 'domains_share_calendar': 'Data domains whose clocks share a calendar', 'processes_share_time_filtered_view': 'Processes sharing the domain clock through a view', 'point_in_time_leak': 'TimeManager process reading a current dataset', 'fixed_as_of_input': 'TimeManager process reading a fixed-date dataset', 'input_other_time_manager': 'Process reading a dataset on another TimeManager', 'segments_missing': 'FilterManager segments not computed at the latest date', 'segment_failed': 'FilterManager segment failed at the latest date', 'hollow_run': 'Run that wrote no rows', 'stuck_running': 'Run still marked RUNNING', 'interrupted_run': 'Run interrupted without recording an outcome', 'sql_drift': 'Live SQL different from the stored version', 'history_mixes_versions': 'History computed under several SQL versions', 'dataset_reads_removed_process': 'Dataset reading the values of a removed process', 'dataset_reads_removed_feature': 'Dataset reading a feature removed from the catalog', 'dataset_reads_stale_table': 'Dataset reading a storage table the catalog no longer uses for the feature', 'dataset_reads_missing_table': 'Dataset reading a storage table that no longer exists', 'dataset_feature_no_rows': 'Dataset feature with no stored rows', 'dataset_grain_not_unique': "Dataset reading a feature stored with a wider key, not unique at the dataset's grain", 'relocation_reverted': 'Relocated feature registered or written in its old table again (older client)', 'feature_without_process': 'Feature no process computes any more', 'process_view_missing': 'Process whose view no longer exists', 'dataset_view_missing': 'Dataset whose view no longer exists', 'process_reads_missing_object': 'Process view reading an object that no longer exists', 'process_view_broken': 'Process view that no longer compiles', 'process_reads_unregistered_dataset': 'Process view reading a dataset no longer registered', 'lineage_edge_to_unknown': 'Lineage edge to a view that is no registered process', 'dataset_reads_other_store': 'Dataset reading another feature store (not checked from this one)', 'view_does_not_compile': 'View that does not compile (EXPLAIN fails)', 'view_not_verifiable': 'View this user may not EXPLAIN (missing right): not verified', 'process_reads_inaccessible_object': 'Process view reading an object this user has no right on', 'lineage_stops_no_access': 'Lineage stopping at a view whose definition this user cannot read', 'lineage_not_recorded': 'View whose inputs the lineage graph does not record', 'lineage_stops_unreadable': 'Lineage stopping at a view SHOW VIEW refuses', 'largest_source_unknown': 'Largest source unknown (some sources not readable): no alignment advice', 'source_table_not_readable': 'Source table this user cannot read (read through views)', 'views_not_compiled': 'Views not compiled (over the limit)', 'lineage_split': 'Lineage made of separate networks', 'lineage_isolated': 'Process or dataset with no lineage link', 'process_not_read': 'Process nobody reads (dead end)', 'view_reads_table_without_access_lock': 'View naming a table without LOCKING ROW FOR ACCESS', 'detached_branch': 'Lineage branch no process or dataset reads (dead branch)', 'feature_values_out_of_range': 'Feature values outside their declared range or allowed values', 'sensitive_feature_in_dataset': 'Dataset exposing a feature declared sensitive', **_pu.KIND_LABELS}
LINEAGE_KINDS
module-attribute
¶
LINEAGE_KINDS = ('dataset_reads_removed_process', 'dataset_reads_removed_feature', 'feature_without_process', 'process_view_missing', 'dataset_view_missing', 'process_reads_missing_object', 'process_view_broken', 'process_reads_unregistered_dataset', 'lineage_edge_to_unknown', 'dataset_reads_stale_table', 'dataset_reads_missing_table', 'process_reads_inaccessible_object')
STORAGE_LINEAGE_KINDS
module-attribute
¶
STORAGE_LINEAGE_KINDS = ('dataset_feature_no_rows', 'dataset_grain_not_unique', 'relocation_reverted')
CHECKS
module-attribute
¶
CHECKS = ('entity_scan', 'entity_layout', 'skew', 'distribution', 'order', 'leakage', 'segments', 'sql', 'integrity', 'network', 'dataset_rows', 'usage', 'closed_entities', 'dbc_space', 'feature_properties', 'clock', 'windows', 'glossary', 'documentation_valid_time', 'documentation_confidence', 'metadata_time', 'server_batch', 'source_access')
CHEAP_CHECKS
module-attribute
¶
CHEAP_CHECKS = tuple(c for c in CHECKS if c not in ('entity_scan', 'dataset_rows', 'closed_entities', 'feature_properties'))
_FU_COLUMNS
module-attribute
¶
METADATA_TABLES
module-attribute
¶
METADATA_TABLES = ('FEATURE_CATALOG_NAME', 'PROCESS_CATALOG_NAME', 'DATA_DISTRIBUTION_NAME', 'FILTER_MANAGER_NAME', 'TIME_MANAGER_NAME')
_FROM_ENDERS
module-attribute
¶
_FROM_ENDERS = {'WHERE', 'GROUP', 'ORDER', 'HAVING', 'QUALIFY', 'UNION', 'INTERSECT', 'EXCEPT', 'MINUS', 'SAMPLE', 'WINDOW', 'LIMIT'}
_NOT_ALIAS
module-attribute
¶
_NOT_ALIAS = _FROM_ENDERS | {'ON', 'USING', 'JOIN', 'INNER', 'LEFT', 'RIGHT', 'FULL', 'OUTER', 'CROSS', 'NATURAL', 'WITH', 'LOCK', 'LOCKING', 'AS'}
_FROM_IN_FUNCTION
module-attribute
¶
_MANAGER_JOIN_RISK
module-attribute
¶
_MANAGER_JOIN_RISK = "through a join (explicit, a comma list, or a derived table). The query may not work as intended: its value is a join value rather than a constant the optimizer substitutes, and a manager that ever holds two rows multiplies the view's rows silently, where a scalar subquery fails (Error 3669)."
_MANAGER_OTHER_RISK
module-attribute
¶
_MANAGER_OTHER_RISK = 'in another form than a scalar filter (IN, EXISTS, or an intermediate view selecting from it). The query may not work as intended, and what the optimizer does with the value could not be told from the SQL.'
_SMALL_SOURCE_NOTE
module-attribute
¶
_SMALL_SOURCE_NOTE = ' At this size it does no harm today. It will if the table grows, as it may when a process built on a small lab table is migrated to production.'
SCALAR_OF_COLUMN_TYPE
module-attribute
¶
SCALAR_OF_COLUMN_TYPE = "of the column's type: for a TIMESTAMP(0) column (SELECT CAST(SUBSTR(CAST(BUSINESS_DATE AS VARCHAR(40)), 1, 19) AS TIMESTAMP(0)) FROM <time manager view>), for a DATE column (SELECT CAST(BUSINESS_DATE AS DATE) FROM <time manager view>); a direct CAST(BUSINESS_DATE AS TIMESTAMP(0)) is Error 7454 when the manager stores TIMESTAMP(6), as one loaded from a pandas datetime does"
_ACC_EXCEPTION
module-attribute
¶
_ACC_EXCEPTION = 'exception: a view scored on the Analytical Compute Cluster (tdstone2 / Apply) needs the JOIN (a scalar subquery there is Error 6881), so leave that one as it is'
DIMENSIONS
module-attribute
¶
DIMENSIONS = [('lineage', 'Lineage', ('integrity', 'network')), ('entity', 'Entity keys', ('entity_scan',)), ('order', 'Order and time', ('order', 'clock', 'windows')), ('inputs', 'Inputs in time', ('leakage',)), ('runs', 'Runs', ('segments',)), ('sql', 'Process SQL', ('sql', 'source_access')), ('documentation', 'Documentation', ('documentation_confidence', 'documentation_valid_time', 'glossary')), ('refresh', 'Refresh', ('usage',)), ('storage', 'Storage and pruning', ('distribution', 'skew'))]
_LEAKAGE_KINDS
module-attribute
¶
_CHECK_DIMENSION
module-attribute
¶
_CHECK_DIMENSION = {'integrity': 'lineage', 'network': 'lineage', 'dataset_rows': 'lineage', 'entity_scan': 'entity', 'order': 'order', 'clock': 'order', 'windows': 'order', 'leakage': 'inputs', 'segments': 'runs', 'usage': 'refresh', 'closed_entities': 'refresh', 'runs': 'runs', 'sql': 'sql', 'source_access': 'sql', 'distribution': 'storage', 'storage': 'storage', 'documentation_confidence': 'documentation', 'documentation_valid_time': 'documentation', 'glossary': 'documentation'}
_EXEC_CSS
module-attribute
¶
_EXEC_CSS = '<style>\n.twa-exec{margin:4px 0 18px}\n.twa-exec h3{margin:0 0 8px;font-size:1.05rem}\n.twa-cards{display:flex;flex-wrap:wrap;gap:10px;margin:6px 0 10px}\n.twa-card{border:1px solid rgba(127,127,127,.35);border-left:4px solid #FF5F00;border-radius:8px;padding:6px 12px;min-width:110px}\n.twa-card b{display:block;font-size:1.35rem;line-height:1.2}\n.twa-card span{font-size:.78rem;opacity:.8}\n.twa-card.e{border-left-color:#C62828}.twa-card.w{border-left-color:#EF6C00}\n.twa-card.i{border-left-color:#2F6E9E}.twa-card.o{border-left-color:#2E7D32}\n.twa-verdict{margin:4px 0 8px}\n.twa-top{margin:0 0 12px 18px;padding:0}\n.twa-gridwrap{overflow-x:auto;max-width:100%}\ntable.twa-grid{border-collapse:separate;border-spacing:3px;font-size:.82rem}\ntable.twa-grid th{font-weight:600;text-align:left;padding:2px 6px;white-space:nowrap}\ntable.twa-grid th.d{text-align:center;max-width:90px;white-space:normal}\ntable.twa-grid td.p{padding:2px 8px;white-space:nowrap;max-width:320px;overflow:hidden;text-overflow:ellipsis}\ntable.twa-grid tr.wave td{padding:8px 4px 2px;font-weight:600;color:#FF5F00;border-bottom:1px solid rgba(127,127,127,.3)}\ntd.twa-c{width:74px;text-align:center;color:#fff;border-radius:4px;font-weight:700}\ntd.twa-error{background:#C62828}td.twa-warning{background:#EF6C00}td.twa-info{background:#2F6E9E}\ntd.twa-ok{background:#2E7D32}td.twa-na{background:rgba(127,127,127,.35);color:inherit;font-weight:400}\n.twa-legend{font-size:.78rem;opacity:.85;margin-top:6px}\n.twa-legend i{display:inline-block;width:12px;height:12px;border-radius:3px;vertical-align:middle;margin:0 4px 0 10px}\n</style>'
_CELL_MARK
module-attribute
¶
_CELL_MARK = {'error': '✖', 'warning': '▲', 'info': '●', 'ok': '✓', 'n/a': '–'}
_CELL_WORD
module-attribute
¶
_CELL_WORD = {'error': 'error', 'warning': 'warning', 'info': 'info', 'ok': 'nothing to report', 'n/a': 'not checked'}
_MD_MARK
module-attribute
¶
logger_safe
¶
Wrapper around the global logger that only emits logs when
tdfs4ds.DISPLAY_LOGS is True. level is a string like "info", "error", etc.
qualified
¶
Build db.obj with each part quoted only as needed.
qualified('TDB', 'FS_X') == 'TDB.FS_X' (unchanged for ordinary names);
qualified('SVC@CORP', 'FS_X') == '"SVC@CORP".FS_X'. An empty/None
database yields the bare object name, so unqualified callers keep working.
force=True quotes both parts unconditionally — only for the sites that
have always emitted quotes and whose exact text is already persisted (dataset
view DDL, returned volatile-table names).
sql_literal
¶
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.
_finding
¶
A finding. pids: the processes it concerns (the executive summary places
it on their rows); ref: entity=(DOMAIN, KEY) or table='DB.T' for the
findings that are mapped to processes later, in the model.
_tag
¶
Place findings (a slice just produced) on the processes pids, unless a finding already names its own.
prepare_followup
¶
FS_FOLLOW_UP rows -> pid, run_id, start, end, status, vdate, dkey, seg.
vdate is the business date (VALIDTIME_DATE, NaT for a real-time run),
dkey its day as text ('' in real time), seg the applied filter ('' when
unsegmented). Pure.
date_states
¶
{(pid, dkey): state} for the TimeManager rows (dkey != '').
A state describes the last computation at that business date, per segment:
ok_start / ok_end (first start and last end of the latest COMPLETED
row of each segment), failed / hollow (a segment whose latest row
failed / wrote nothing, with its start), completed, vdate. Pure.
time_groups
¶
{"driver": {pid: manager}, "group": {manager: group id}} from the
time-driver model. A manager outside any synchronised / clone group is its
own group. Pure.
_same_group
¶
True / False when both processes have a known driver, else None.
direct_edges
¶
The process dependencies without the transitive ones (q -> p). A
cycle keeps every edge. Pure.
process_calendars
¶
{pid: ['YYYY-MM-DD', ...]}: the dates of the manager driving each process, in TIME_ID
order, when they were read (0.3.7.12). Pure.
domain_clocked
¶
{pid: data domain} of the processes on their domain's clock (the clock or a soft clone of
it). For them a replay is roll_out(data_domain=...), which keeps the processes downstream in
step; a process on another manager is replayed alone (0.3.7.13). Pure.
_usable_calendars
¶
The calendars that hold at least one of their process's follow-up dates. A calendar holding none cannot be the one the process ran on (or was read in another format): it is ignored, so the checks fall back to every date rather than hiding all of them. Pure.
date_order_findings
¶
date_order_findings(fu: DataFrame, names: Optional[dict] = None, calendars: Optional[Dict[str, List[str]]] = None, history_from_data: Optional[set] = None, domains: Optional[Dict[str, str]] = None) -> List[dict]
A business date whose latest run started before a run at an earlier date of the same process ended. Built forward, each date runs after the one before; otherwise the later date did not see the earlier ones, and a run also writes from its date onward. Pure.
calendars (0.3.7.12): {pid: dates of its manager}. Only those dates are compared: a run at
another date (run(data_domain=...) at the database clock, run(..., at=...)) is not part of
the history a roll_out builds, and no roll_out recomputes it. A process without a known
calendar keeps every date. history_from_data: processes with valid_time_column, whose
values take their valid time from the data, not from the run's date.
quality_findings
¶
feature_values_out_of_range from tdfs4ds.feature_props.check_feature_properties(history=True):
one frame row per feature with N_ROWS, N_OUT_OF_RANGE, N_NOT_ALLOWED, N_UNEXPECTED_NULL
and FIRST_VIOLATION. A feature whose share of rows breaking a declared property (out of range +
not allowed + unexpected NULL) is above threshold is a warning, with the date of its first
violation. Pure; the values are only counted, never changed or left out.
sensitive_reach_findings
¶
sensitive_feature_in_dataset from :func:tdfs4ds.lineage.sensitivity.describe_reach rows
(datasets and the processes reading them). Pure; nothing declared sensitive gives nothing.
_glossary_module
¶
The glossary module (plain code: no model call). Loaded by name: it lives in tdfs4ds.genai,
whose package the no-language-model guard of this module keeps out of its imports.
dbc_space_findings
¶
space: (vproc, current perm, max perm) of database DBC. DBC fills unevenly and refuses a
write as soon as one AMP is full, so the fullest AMP decides. Pure.
server_batch_findings
¶
found: {'installed': [...], 'registered': {...}} of the server-side batch objects
(tdfs4ds.server_side_batch, 0.3.8.0). Pure; findings: object missing while the setting is on,
registered text drifted from this version's, registered but not installed, installed but unregistered.
future_metadata_findings
¶
rows: (table, n rows, earliest ValidStart) of catalog rows valid from a FUTURE time. Before
0.3.7.34 a registration during a roll_out at a future business date (a forecast) stamped the catalog
at that date; the catalog is now read at the current time, so those rows are invisible until then
(a feature looks unregistered, a run registers it again under a new FEATURE_ID). Pure.
clock_findings
¶
statuses: domain_clock_status dicts. A domain clock more than behind_steps business dates
behind what its rule says is due by now (clock_behind), and the dates a catch_up='latest'
refresh skipped (calendar_gap). Pure.
calendar_state_findings
¶
Findings from :func:tdfs4ds.utils.calendar_change.collect_calendar_states states (0.3.7.31): a
table of dates with no stored rule that has one (calendar_rule_inferable, info) or none
(calendar_irregular, info), or a stored rule that some dates do not fit (calendar_off_rule_dates,
warning). Pure.
window_shape_findings
¶
Findings from classified process windows (lineage.window_shape.window_findings). Pure.
domain_clock_findings
¶
A process of a data domain that has a clock (0.3.6.0) but reads no manager on its
dates (or another one): run(data_domain=...) / roll_out(data_domain=...) cannot
keep it in step. Pure.
rollout_coverage_findings
¶
Will roll_out(data_domain=...) move every TimeManager the processes of each checked data
domain read, and is a manager read by several data domains? (0.3.7.22) Pure.
The rule lives once, in time_manager_report.rollout_coverage (the TimeManager report shows
the same verdicts): with a clock, a process reading a manager on other dates makes the
domain's roll-out refuse before its first date (error); without a clock, processes on several
tables of dates leave no single roll-out (warning); one manager read by processes of several
domains moves for all of them (warning); two clocks on one table (info).
_upstream_status_text
¶
2026-01-01: FAILED,... ; 2026-01-02: COMPLETED,0 rows from (date, status) pairs (status cut at 160
characters here, the follow-up keeps the whole text).
order_findings
¶
Findings for each dependency q -> p (q upstream). Pure.
TimeManager rows are compared business date by business date; real-time rows by overlap of the runs only (two real-time processes on different cadences are normal).
input_datasets
¶
Dataset nodes a process view reads, walking through plain views and stopping at datasets and at other processes' views. Pure.
leakage_findings
¶
(findings, unverifiable). A process counts as TimeManager-driven when
its view reads a manager or its runs carry a business date. Pure.
segment_findings
¶
segment_findings(fu: DataFrame, expected: Dict[str, int], names=None, now=None, stuck_hours: Optional[float] = None, stuck_factor: float = 10, live=None, calendars=None, domains=None) -> List[dict]
Missing / failed segments and hollow runs at each process's latest date,
rows left at RUNNING at any date. expected: {pid: number of FilterManager rows}.
RUNNING rows (0.3.7.2): interrupted_run (info) when a later row exists for the
same process, business date and segment; stuck_running (warning) for a row with
nothing after it older than max(stuck_hours or 1 h, stuck_factor x the longest
COMPLETED run of the process). live: {(run_id, process_id)} carried by the
database's sessions (None = not read): a row no session carries is reported as
interrupted_run whatever its age. Pure.
_rollout_resume
¶
(call, reason) resuming a roll-out from dkey, or None (0.3.7.12). Proposed when the lost
row belongs to a roll-out (rows at several business dates under its RUN_ID), or when its date is a
date of the process's calendar other than the last (a roll-out cut on its first date leaves a single
date under a fresh RUN_ID). run(pid) would compute one date, at the cursor, and leave the later
dates and the processes downstream. Pure.
_open_run_findings
¶
_open_run_findings(fu, names, now, stuck_hours, stuck_factor, live, calendars=None, domains=None) -> List[dict]
interrupted_run / stuck_running findings (see :func:segment_findings). Pure.
integrity_findings
¶
Findings from :func:tdfs4ds.dependencies.lineage_gaps. Each names its
fix; a gap that leaves a dead branch also carries removal, the objects to
pass to :func:tdfs4ds.plan_removal. With a scope (processes or data
domains), only the gaps touching it are kept. Pure.
dataset_rows_findings
¶
dataset_feature_no_rows findings from the storage-level check. rows:
{"reads": dependencies.dataset_feature_reads(H), "scan": scan_storage_orphans(
by_version=True), "completed": {process id: COMPLETED runs} or None}.
A feature read has no rows when the table holds none for its (FEATURE_ID, FEATURE_VERSION) at the valid time the dataset reads (now for a current dataset, any time otherwise). An INNER dataset then returns no row at all (error); a FULL OUTER one reads NULL for the column (warning). The follow-up tells a process that never completed from one whose rows are gone. A table that could not be scanned is skipped (the caller reports it). Pure.
dataset_grain_findings
¶
dataset_grain_not_unique findings from the storage-level check. grain_rows:
rows["grain"] (see :func:read_dataset_rows). A dataset keyed on the primary index of an
extended-entity process reads each feature at that grain (tdfs4ds.dataset.grain); when
the extended key's other columns vary for one entity, the dataset returns several rows per
entity. One finding per dataset. Pure.
relocation_reverted_findings
¶
relocation_reverted findings from the storage-level check. strays:
:func:tdfs4ds.feature_store.relocation.read_relocation_strays.
A relocated feature has a placement tag. A client older than 0.3.3.30 does not know it: when it registers the feature again (a type change, or removed and registered anew) it names the untagged table (the catalog row follows) and writes its values there, so the history is split over two tables and the datasets read either. Pure.
network_nodes
¶
({node: {"pid", "label"}}, {node: {"label"}}) of the registered
process and dataset views, keyed like the persisted lineage graph and
labelled like :func:tdfs4ds.dependencies.build_dependency_graph. Pure.
network_scope_findings
¶
:func:tdfs4ds.lineage.network_health.network_findings, without the
objects the gap check already reported. With a process scope, the findings
about other processes are dropped; those about the whole network stay. Pure.
sql_findings
¶
sql_findings(versions: Dict[str, list], drift: Dict[str, dict], fu: DataFrame, names=None) -> List[dict]
versions: {pid: [{"PROCESS_VERSION", "VALID_FROM", "VALID_TO"}]};
drift: {pid: {"since", "changed_steps"}}. Pure.
relations_read
¶
The relations a query reads in FROM / JOIN (comma lists included), as written.
Left out: names defined by WITH, derived tables (their own FROM are read), table
operators and functions (a name followed by a parenthesis), and the FROM of EXTRACT /
TRIM / SUBSTRING. Pure, never raises.
_lock_state
¶
True: the view starts with a LOCKING ... FOR ACCESS modifier; False: it does not; None: no text to read.
source_access_findings
¶
(findings, unverifiable): every view of a process chain (the process view and the views
beneath it) that names a TABLE in its own FROM / JOIN must start with LOCKING ROW FOR ACCESS.
One rule, whatever the view's place in the chain: a view reading only views needs nothing, a
view reading a table needs the modifier (Denis, 0.3.8.15). Pure.
chains: {pid: {"row", "chain"}} as :func:read_chains returns it (chain =
read_sql_chain: steps = the process view then the views it reads, inputs = where it
stops, tables included, each with read_by = the 1-based steps naming it). kinds:
{DB.OBJ: 'T'|'V'} for names the chain does not classify. managers: {pid: [DB.VIEW]}
more manager names to ignore (the chain's own are always ignored). store_dbs: databases of
the store, whose TDFS_* helpers are ignored. A view whose text could not be read is
unverifiable, never a finding.
entity_count_sql
¶
Distinct entity tuples of a storage table, for the key and the key minus
each column, over the whole history (H:) and now (C:). One request.
The temporal qualifier sits inside each derived table (a derived table refuses CURRENT, and a UNION branch refuses a leading qualifier: Error 9345); the label is CAST because the first branch types the column.
redundancy
¶
(determined over the whole history, determined now only). Pure.
reduce_entity_key
¶
Greedy reduction: drop a column the others determine over the whole history, re-count, until none is left (at most one round per column). run_sql returns the rows of a statement. Pure apart from run_sql.
pi_grain_processes
¶
Process ids of domain whose entity is exactly key_cols and whose recorded primary index
is key_cols minus extra_cols, where an extra column is in the partitioning or the process
has a FilterManager: the extra column is there to partition or segment, and a dataset keyed on
the primary index reads the process's features at that grain (tdfs4ds.dataset.grain). Pure.
entity_scan_findings
¶
Findings from :func:reduce_entity_key results. pi: {(DB, TABLE):
[columns]}. Pure.
_pairs_with_results
¶
Each entity-scan finding with the scan result it came from (same object).
entity_superset_findings
¶
Two entity keys of one domain where one contains the other. Pure.
type_family
¶
The family that decides whether two columns join without conversion.
type_mismatch_findings
¶
columns: [(db, table, column, family)]; entity_cols: {(DB, TABLE):
{COL}}. Pure.
skew_findings
¶
sizes: {(db, table): [CurrentPerm per AMP]}. Skew = 1 - avg / max. Pure.
source_tables
¶
Tables a process view reads: walk through plain views, stop at datasets, at other processes' views and at manager / FS objects. Pure.
aligned_pi
¶
The entity columns that carry the source's primary-index columns, in the
source's PI order; None unless every PI column maps. origins: {entity
col: {"node", "column"}} from :func:column_lineage. Pure.
explain_staging_distribution
¶
How the rows reach the probe table of a staging CTAS EXPLAIN: "local"
(the spool feeding it is built locally), "redistributed" (by hash code),
"duplicated", or None when the text does not say. Read from the steps,
never counted. Pure.
table_aliases
¶
Correlation names the view SQL gives source_node: EXPLAIN names a table
by them (DB_SOURCE.A in view ..., seen live), not by its name. Pure.
source_read_access
¶
How an EXPLAIN reads source_node ('DB.TABLE'): "partitions" (partition
elimination, incl. a single partition), "all_rows" (no elimination), or
None when no step names it. aliases: correlation names of the table (see
:func:table_aliases). The worst step wins. Pure.
cast_partition_condition
¶
The partitioning column of source_node that a plan step compares, cast to a TIMESTAMP ... WITH
TIME ZONE, with a parameter (CAST((DB.h in view V.TD_TIMECODE) AS TIMESTAMP(6) WITH TIME ZONE) <
:%SSQ27, measured on a TIMESTAMP(0) column compared with a TIMESTAMP(6) WITH TIME ZONE scalar), else
None. The column is cast, not the scalar, so no partition can be eliminated: a fact of the SQL,
which a static plan shows as well as a dynamic one. Pure.
partition_columns
¶
Columns of a table named in its partitioning expression (FEATURE_ID and the valid-time columns left out). Pure.
partition_levels
¶
The columns of each partitioning level, in level order (DBC keeps the levels in
order: CHECK (/*02*/ RANGE_N(d ...) IS NOT NULL AND CASE_N(region ...) IS NOT NULL ),
read live). Literals are removed first: region = 'N' must not name a column N. Pure.
_enclosing_paren
¶
Index of the parenthesis enclosing pos, or -1 at the top level.
_managers_in_use
¶
The manager views in use though the lineage graph shows no reader: the domain clocks, and the managers the datasets read (a dataset's edges lead to process views only). Pure.
_is_derived_table_paren
¶
The parenthesis at opening opens a derived table: after FROM / JOIN, or after a
comma of a FROM list (a comma of a SELECT list opens a scalar subquery). Pure.
_reads_at_own_level
¶
pattern finds a read that gives body (a parenthesised WITH body) its rows: at the
body's own level or in a derived table, never inside a scalar or IN subquery. Pure.
_cte_names_reading
¶
The WITH names of flat that stand for what the reads pattern finds: their body selects
from it, directly or through another such name. A body that only filters on it through a scalar
subquery holds source rows, so it does not stand for it. Pure, on the flattened upper-case text.
scope_time_model
¶
The time-driver model reduced to the managers the checked processes read or declare, and their tables of dates: a manager nothing in scope uses (a leftover of a test, another domain's clock) is not part of this assessment. Pure.
_strip_comments
¶
The SQL without -- ... and /* ... */ comments (a comment between a comma and a
derived table hid the table; string literals are left alone). Pure.
_is_cte_body_paren
¶
The parenthesis at opening opens the body of a WITH name (WITH x [(cols)] AS (). Pure.
_read_context
¶
Where the read at pos gives its rows: "join" (a derived table of the main FROM list, nested
derived tables included), "other" (a whole select, or an IN / EXISTS / ANY subquery),
"scalar" (inside a scalar subquery, however many derived tables deep: the comparison is found by
the caller), "cte" (inside a WITH body: the name stands for it) or "". Pure.
manager_read_shape
¶
How the view SQL reads a TimeManager or FilterManager: {"scalar_columns": [...],
"join": bool, "other": bool}.
Scalar = a one-table subquery used as a value (src.d <= (SELECT BUSINESS_DATE FROM tm),
CAST((SELECT ...) AS DATE), a BETWEEN bound). Join = the manager in a JOIN or a
comma list, as a table or as a derived table. Other = IN / EXISTS / ANY, or a whole
SELECT over the manager, which another view then reads (an intermediate view: what that view
does with it cannot be told from this step). Pure, on the flattened text.
shape_not_recognised
¶
The process's own SQL names the manager, yet :func:manager_read_shape found no read: the
check saw nothing, which must not read as a pass. A manager its SQL does not name is read
upstream (through a dataset), and there is no shape to judge. Pure.
time_filter_shape
¶
:func:manager_read_shape for a TimeManager (the name the callers already use).
_entity_for_source_column
¶
The entity column the view passes source_column of source (default: the largest source) as.
segments_follow_partitioning
¶
A FilterManager column names a partitioning column of the largest source, directly or as the entity column the view passes it as. Pure.
skipped_partition_levels
¶
The higher levels of source's partitioning that a filter on a lower level leaves
unfiltered, or None. A column the FilterManager or the TimeManager's scalar
filter names counts (directly, or as the entity column the view passes it as). A filter on
no level at all is not reported here: nothing says it applies to this source. Pure.
_small_source_note
¶
No size gate on what the view's SQL does to a partitioned source: a process built on small lab tables meets large ones once migrated, so the finding says so instead of staying silent.
largest_source_has_own_finding
¶
The largest source's whole read is already told by another finding: the TimeManager scalar is on
one of its partitioning columns (time_filter_defeats_pruning) or the FilterManager segments follow
its partitioning. A manager that filters some other column does not cover it (a view can bound
only a key table's date and join the historian unbounded, field report). Pure.
_whole_read_reported
¶
partitioned_source_read_whole fires for the largest source of r. Pure.
_plan_sentence
¶
What the plan read of the largest source shows. A statement about partitions needs a plan with the date known: a static plan understates elimination, and the SQL's shape alone proves nothing (a view can also filter that column in a form this check does not see). Pure.
source_statistics_statement
¶
The COLLECT STATISTICS statement that gives the largest source of r the statistics a
plan on it needs: its primary index, its partitioning (PARTITION) and the columns the
view filters on through a manager. Pure.
source_without_statistics_finding
¶
source_without_statistics_finding(r: dict, align_min_mb: float = 1000, names=None) -> Optional[dict]
source_without_statistics (info) for the largest source of process row r: a table of at
least align_min_mb MB with no statistic at all, so the optimizer plans its joins and filters
on guesses. The table's owner defines them (the process cannot). Pure; None when it does not apply.
distribution_findings
¶
distribution_findings(rows: List[dict], *, align_min_mb: float = 1000, skew_threshold: float = 0.25, names=None) -> List[dict]
rows: one per process (see :func:collect_distribution). Grouped per
(domain, entity key): the recommendation is for the entity, never one
process. Pure.
_pid_in
¶
The process id a finding's object ends with, as <view> (<process id>).
process_waves
¶
{pid: wave}: the execution waves of the process DAG (wave 0 = runs
first), the same layering as :func:tdfs4ds.analyze_parallel_plan. Empty on
a cycle; absent processes (unknown to the lineage graph) get no wave. Pure.
place_findings
¶
Give each finding the processes it concerns (pids), for the summary:
its own process (object <view> (<pid>)), the processes of its entity
(entity=(DOMAIN, KEY)) or those writing its table (table='DB.T'). A
store-level finding (an entity column typed differently) keeps none. Pure.
health_model
¶
One row per process, ordered by execution wave, one cell per dimension:
the worst severity of its findings, "ok" when the dimension was checked
and found nothing, "n/a" when it was not (check not run, or not
verifiable for that process). Also the verdict counts and the most frequent
issues. Pure.
gap_branches
¶
The dead branch each lineage gap leaves: [{"from", "kind", "branch"}],
only the gaps whose branch is not empty. Pure.
_network_html
¶
The lineage network section: compilation, connected networks, dead branches. '' when the network check did not run.
_storage_level_note
¶
Whether the storage level of the dataset check ran, and when ('' when the check was not part of the assessment).
_lineage_checked_html
¶
What the lineage integrity check read and looked for ('' when it did not run).
refresh_note
¶
What the refresh checks covered, as plain text ('' when neither ran). Pure.
_dataset_rows_summary
¶
What the storage-level check covered (None when it did not run). Pure.
documentation_scope
¶
What a data-domain filter keeps among documented objects (pure; None = no filter).
{'domains': {...}, 'objects': {'DB.NAME', ...}}: the process views of the requested domains,
the objects those processes read (lineage descendants) and the datasets reading them (lineage
ancestors of type 'D'). An object outside it cannot be attributed to the domains.
in_documentation_scope
¶
Whether obj (DB.NAME or bare name, possibly followed by [domain]) is kept by scope.
scope_calendar_states
¶
The calendar states of the tables of dates the in-scope processes read, or that are the clock of a requested domain (pure). A table of dates nothing in scope uses (another domain's clock, a leftover, one whose table was dropped) is left out.
scope_documentation_inputs
¶
The documentation inputs (confidence, valid time, glossary) restricted to the requested data domains. Same inputs when there is no domain filter. Pure; returns a shallow copy.
build_workflow_model
¶
build_workflow_model(inputs: dict, *, skew_threshold: float = 0.25, skew_min_mb: float = 100, stuck_hours: Optional[float] = None, align_min_mb: float = 1000, quality_threshold: float = 0.01) -> dict
Findings, counts and what could not be checked. Pure.
render_executive_summary
¶
The verdict, the most frequent issues and the health grid: one row per process, grouped by execution wave, one cell per dimension (worst severity; the issues in the tooltip). Scriptless HTML.
_accept_payload
¶
The finding as the admin app posts it back to accept it (JSON).
_accepted_html
¶
The Accepted section: every accepted finding with its justification, who, when and until when, the acceptances that expired (their findings are open again) and the ones expiring soon. Empty when the store holds no acceptance. actions: the admin app's Revoke buttons.
accepted_markdown
¶
The Accepted section of the Markdown report ([] when the store holds no acceptance).
render_workflow_html
¶
'Workflow assessment' body: the executive summary, then one group per area (the consistency style).
render_workflow_markdown
¶
The assessment as Markdown: verdict, top issues, the health grid by wave, then the findings per area and what could not be verified.
network_markdown
¶
The lineage network section of the Markdown report ([] when not checked).
render_workflow_page
¶
A standalone HTML page (the panel's content, for export): offline, no script.
_properties_declared
¶
True when feature properties are declared in the store (no statement: a module flag).
_checks_not_run_note
¶
Says which checks a report leaves out, so a clean report is never read as covering them.
write_workflow_report
¶
Write the assessment as html (standalone page), md or csv
(findings) and return the path. Default path: DASHBOARD_REPORT_DIR.
_scope_processes
¶
read_followup
¶
Follow-up rows of the processes started in the last days days (primary store).
read_dataset_modes
¶
{dataset node: {"mode", "as_of", "tm"}} from the build view, then the
view's DDL for a dataset without a build row (at most max_ddl reads).
read_expected_segments
¶
({pid: FilterManager rows}, unverifiable) - one COUNT per manager table.
read_chains
¶
({pid: {"row", "chain"}}, unverifiable): the live SQL chain of each
process (SHOW VIEW of its view and of the views it reads), read once and
shared by the SQL drift and distribution checks; at most max_n.
read_versions
¶
(versions, drift, unverifiable) from FS_PROCESS_SQL (two reads) and the
live chains read by :func:read_chains.
_probe_sql
¶
The staging CTAS of an ingestion, for EXPLAIN only (never executed).
_segment_plan
¶
(plan text, dynamic): the plan of the process view for the active
FilterManager segment, with incremental planning forced (DYNAMIC EXPLAIN,
the segment's value known) when the session allows it, else the static plan.
A static plan leaves the segment value as a parameter and understates
partition elimination (seen live).
plan_access
¶
How the plan of the SELECT sql reads the table source ('DB.TABLE'):
"partitions" (partition elimination, or a PTI time range), "all_rows",
or None when no step reads it. dynamic=True plans with the subquery values
known (DYNAMIC EXPLAIN with incremental planning forced, the session's
query band restored); False is the static plan, which leaves a scalar
subquery's value as a parameter. EXPLAIN only: nothing runs.
collect_distribution
¶
collect_distribution(proc, feat, graph, chains, layout, expected_segments=None, max_explain: int = 30, emit=None, drivers=None) -> tuple
(rows, unverifiable): per denormalized-view process, its storage tables
(PI, partitioning), its largest source (size, skew, PI, partitioning), the
origin of each entity column, the aligned PI and the EXPLAIN evidence. Reads:
the dictionary for the sources (batched) and at most max_explain x 3 EXPLAINs.
read_storage_layout
¶
Primary index, row counts, entity column types and AMP sizes of the
storage tables (batched DBC reads). {"ok": False} when DBC is unreadable.
scan_entity_keys
¶
One :func:reduce_entity_key per (domain, entity key) of two columns or
more, on its largest storage table (StatsV row count, else any).
read_grain
¶
The dataset_grain_not_unique read: the features datasets read at their primary-index grain
that are NOT unique there now. Nothing is read (no statement) when no dataset reads such a
feature; otherwise the datasets' entities (one catalog read) and ONE uniqueness statement for
every such feature (tdfs4ds.dataset.grain.grain_check_sql). Raises on a failed read.
read_dataset_rows
¶
The storage level of the dataset-feature check: rows per (FEATURE_ID,
FEATURE_VERSION) of every storage table the datasets read (one grouped pass
per table, now and over the whole history), and the COMPLETED runs of the
producing processes. (rows, unverifiable); each failed read is an
unverifiable entry, never an empty result read as "all fine".
collect_workflow_inputs
¶
collect_workflow_inputs(processes=None, data_domains=None, checks=None, days: int = 90, max_sql_processes: int = 100, emit=None) -> dict
Everything :func:build_workflow_model needs. Each read is fail-open: a
failure becomes an unverifiable entry, never an empty "all clear".
collect_future_metadata
¶
(table, rows, earliest ValidStart) of the valid-time catalog tables holding rows valid from a future
time (check metadata_time). Only valid-time tables are read: FS_DATA_DISTRIBUTION is created without
validity columns when DATA_DISTRIBUTION_TEMPORAL is False (field report: Error 5628 "Column ValidStart not
found"). An unreadable table goes to unknown; an absent one or one without ValidStart is skipped.
_collect_feature_properties
¶
The feature_properties check's reads (on demand, possibly expensive: it counts stored values
against the declared properties). Nothing declared (feature_props.state.PRESENT False, or the
package part absent) = no statement and no input: the report is what it always was. The dependency
graph is built only when a sensitive feature is declared (the integrity check's, when it ran).
assess_workflow
¶
assess_workflow(processes=None, data_domains=None, checks=None, entity_scan: bool = True, days: int = 90, display: bool = True, skew_threshold: float = 0.25, skew_min_mb: float = 100, stuck_hours: Optional[float] = None, align_min_mb: float = 1000, progress=None, dataset_rows: bool = True, closed_entities: bool = True, quality_threshold: float = 0.01) -> dict
Assess how the workflow is built: entity keys, run order and time synchronisation, point-in-time inputs, segments, process SQL, storage.
Parameters¶
processes : list of str, optional
Process ids or view names to assess (default: every process).
data_domains : str or list, optional
Restrict to these data domains.
checks : iterable, optional
A subset of :data:CHECKS (default: all of them).
entity_scan : bool
Read the storage tables to test the entity keys (one grouped pass per
entity over its largest table). False skips the only expensive read.
dataset_rows : bool
Count the stored rows behind every dataset feature (one grouped pass per
storage table the datasets read). False keeps the dictionary-level
checks only.
closed_entities : bool
Read the storage tables of each process whose close_absent_entities is off, for
entities with no open validity period (closed_without_flag). False keeps the
usage check (loops around run(), a view rewritten between runs, recursion).
days : int
Follow-up window, in days, for the run checks.
display : bool
Print a summary and the findings.
progress : callable, optional
Called with one line per step.
quality_threshold : float
feature_properties check (on demand, only when properties are declared): the share of checked
rows breaking a declared range / allowed values / NULL rule above which a feature is reported
(default 1%).
Returns¶
dict
findings (area, kind, object, detail, severity, fix), counts,
unverifiable (checks that could not run, with the reason),
summary, entities (entity scan results), checks.
No language model is used, and nothing is changed: every finding names the command that fixes it.
sanity_check
¶
sanity_check(out_path: Optional[str] = None, fmt: Optional[str] = None, *, processes=None, data_domains=None, scope: str = 'cheap', display: bool = True, quality_threshold: float = 0.01) -> str
Run the sanity checks and write the report, in one call.
Parameters¶
out_path : str, optional
The report file. Default: DASHBOARD_REPORT_DIR, as in :func:write_workflow_report.
fmt : str, optional
'html' or 'md' ('csv' gives the findings alone). Default: from the
extension of out_path, else 'html'.
processes, data_domains
Restrict the checks, as in :func:assess_workflow.
scope : str
'cheap' (default): the checks a migration report runs, closed entities
included. 'full' adds the entity and dataset scans, which read every
storage table the checks concern. The report names the checks it left out.
display : bool
Print the summary and the findings.
Returns¶
str
The path of the report. For the findings as data, use :func:assess_workflow
and :func:write_workflow_report.
No language model is used, and nothing is changed.