Skip to content

Sanity checks

tdfs4ds.sanity_check runs the workflow assessment in one call and writes a report: is this pipeline built so that it keeps working, and can run() and roll_out() still refresh every process? This page is the reference: the call, what each scope runs, what each check reads and costs, how to read the report, and every finding the checks can raise. How to act on the findings, in what order, is in Assess workflow health.

The checks use no language model, change nothing, and say what they could not check: a failed read is listed as not verified, never reported as a pass. A finding names the command that fixes it; it never runs it.

import tdfs4ds

tdfs4ds.connect(database='MY_DATABASE')
path = tdfs4ds.sanity_check('sanity_report.html')                    # cheap scope; returns the path
path = tdfs4ds.sanity_check('sanity_full.md', scope='full', data_domains=['SALES'])
Argument Meaning
out_path The report file. Default: tdfs4ds.DASHBOARD_REPORT_DIR
fmt 'html' or 'md'; 'csv' writes the findings alone. Default: the file extension, else HTML
processes Process ids or view names. Default: every process
data_domains Restrict to these data domains
scope 'cheap' (default) or 'full', see below
display Print the summary and the findings. Default True
quality_threshold Share of rows breaking a declared property above which a feature is reported (default 1%); feature_properties only

The format and the scope are checked before anything is read.

Scopes

Scope Checks run Reads storage tables?
'cheap' (default) tdfs4ds.workflow_assessment.CHEAP_CHECKS plus closed_entities: the set a migration report runs only closed_entities, and its EXPLAIN goes first
'full' every check, tdfs4ds.workflow_assessment.CHECKS yes: entity_scan, dataset_rows, closed_entities, feature_properties

tdfs4ds.migration.sanity.check_names(mode) returns the list a scope stands for; a check added later is picked up by itself. The report names the checks a scope left out ("Checks not run").

For a choice per check, call assess_workflow and pass checks=:

report = tdfs4ds.assess_workflow(
    data_domains=['SALES'], processes=None, days=90,
    checks=['integrity', 'network', 'order', 'clock', 'segments'],
)
tdfs4ds.write_workflow_report(report, fmt='html')       # or 'md', 'csv'; returns the path

entity_scan=False, dataset_rows=False and closed_entities=False keep a full run away from the storage reads. days= is the follow-up window of the run checks, stuck_hours= raises the floor of stuck_running, skew_threshold, skew_min_mb and align_min_mb set the storage thresholds.

The checks

Check Cheap scope Reads Cost
integrity yes catalogs, persisted lineage graph, dataset view definitions (SHOW VIEW), DBC.TablesV; EXPLAIN only on processes that read a missing object cheap
network yes EXPLAIN on every process view, dataset view and view of the lineage graph; where the lineage stops cheap, grows with the number of views
order yes follow-up table, lineage graph, the time-driver model (managers, domain clocks, calendars) cheap
clock yes the clock status of each data domain that has one (rule, dates held, dates due now) and the calendar of every TimeManager (rule stored, inferable, irregular, dates off the rule) (0.3.7.31) cheap
windows yes the SQL chain of each process: windows written by hand from the TimeManager value (ADD_MONTHS, INTERVAL) compared with the step of the calendar (0.3.7.31) cheap
leakage yes lineage graph and the way each dataset reads time (build table, view definition) cheap
segments yes follow-up table, FilterManager content, live sessions carrying a run cheap
sql yes stored SQL versions against the live SQL cheap
usage yes follow-up table, stored SQL versions, the SQL chain cheap
entity_layout yes data dictionary: entity keys and column types of the storage tables cheap
skew yes data dictionary: table sizes per AMP cheap
distribution yes data dictionary, source table layout, EXPLAIN and DYNAMIC EXPLAIN of the staging step (nothing is created) cheap
dbc_space yes DBC.DiskSpaceV for database DBC one read
entity_scan no storage tables: one grouped pass per entity on its largest table on demand
dataset_rows no storage tables: one grouped pass per table the datasets read, plus the producers' completed runs on demand
closed_entities yes (EXPLAIN-gated) storage tables, restricted to the process's features, and the query log (DBC.QryLogV). Above 60 seconds or 10 GB of spool in EXPLAIN the check reports not verified and does not run on demand
feature_properties no storage tables: counts stored values against the declared ranges, allowed values and NULL rules; follows sensitive features to datasets through the dependency graph. Nothing is read when no property is declared on demand

The order, leakage, integrity and network checks need the persisted lineage graph. When it is empty they are listed as not verified; fill it with tdfs4ds.rebuild_lineage_graph(all_data_domains=True).

The report

Executive summary. The report opens with the verdict: how many processes have an error, a warning, information only, or nothing to report; the most frequent issues; and a health grid, one row per process in execution order (the waves of the execution plan), one column per dimension. A cell shows the worst severity found, ok when the dimension was checked and found nothing, or n/a when its check did not run or could not run for that process.

Dimension Fed by
Lineage integrity, network, dataset_rows
Entity keys entity_scan
Order and time order, clock, windows
Inputs in time leakage
Runs segments; feature-property findings are placed here
Process SQL sql
Refresh usage, closed_entities
Storage and pruning distribution, skew, entity_layout

Severities. error: the pipeline is wrong or cannot work (values computed on failed inputs, a dataset reading a removed process). warning: it works today and is likely to hurt, or a refresh may not reproduce the data. info: an observation to confirm.

Not verified. Every read that failed, with its reason (report['unverifiable']). It is never a pass.

Refresh verdicts. Each process also gets a verdict, report['refresh']['verdicts'][process_id]: refreshable, at risk (a warning), not refreshable (an error: a refresh only repeats the last state) or not checked. It comes from usage and closed_entities; storage_checked says whether the storage read ran. The same verdict is on the process card of the Feature catalog and in the Processes sheet of the catalog export. See Can run() and roll_out() still refresh a process?.

Formats. HTML (a standalone page with the grid and collapsible findings), Markdown, and CSV (the findings alone: area, severity, kind, label, object, detail, fix, processes). write_workflow_report(report, fmt=) writes any of them from an assess_workflow result.

In the app. Run & monitor → Health check: a data-domain list, the cheap checks, a scan button for the checks that read storage, downloads as HTML, Markdown or CSV. The Overview has a Workflow assessment section. The (?) button on the page gives the equivalent Python.

Before a migration. plan_migration(..., sanity='cheap') runs these checks first, on the source store and only on the processes it would promote; 'full' adds the scans, False skips and says so. A finding never blocks migrate_objects. See Before a migration.

Findings as data. Each finding is a dictionary with area, kind, object, detail, severity, fix and pids:

for f in report['findings']:
    print(f['severity'], f['kind'], f['object'], '->', f['fix'])
report['counts']          # {'error': n, 'warning': n, 'info': n}

Every finding

Generated from tdfs4ds.workflow_assessment.WORKFLOW_KIND_LABELS and the code that raises each kind: 81 kinds. Check is the check that raises it (it must be in the scope). Fix is what the finding names; read it, then run it yourself. Details and thresholds: Assess workflow health.

Lineage integrity

Kind What it reports Check Severity Fix
dataset_reads_missing_table Dataset reading a storage table that no longer exists integrity error restore the table, or rebuild the dataset
dataset_reads_other_store Dataset reading another feature store (not checked from this one) integrity info connect(..., databases_readonly=[...]) and assess again
dataset_reads_removed_feature Dataset reading a feature removed from the catalog integrity error rebuild the dataset on current features, or plan_removal
dataset_reads_removed_process Dataset reading the values of a removed process integrity error rebuild the dataset on a registered process, or plan_removal
dataset_reads_stale_table Dataset reading a storage table the catalog no longer uses for the feature integrity error rewrite_dataset_tables(dataset, dry_run=True), or rebuild the dataset
feature_without_process Feature no process computes any more integrity warning register a process computing it again, or plan_removal
lineage_edge_to_unknown Lineage edge to a view that is no registered process integrity info rebuild_lineage_graph(objects=[...], check=False)
process_reads_inaccessible_object Process view reading an object this user has no right on integrity warning ask for the SELECT the finding names, assess again
process_reads_missing_object Process view reading an object that no longer exists integrity error restore the object, or plan_removal
process_reads_unregistered_dataset Process view reading a dataset no longer registered integrity warning restore_dataset_catalog(dry_run=True), or rewrite the view
process_view_broken Process view that no longer compiles integrity error fix the view, or plan_removal
process_view_missing Process whose view no longer exists integrity error restore the view, or plan_removal
detached_branch Lineage branch no process or dataset reads (dead branch) network info drop the unused views, then rebuild_lineage_graph
lineage_isolated Process or dataset with no lineage link network warning rebuild_lineage_graph(objects=[...], check=True)
lineage_not_recorded View whose inputs the lineage graph does not record network warning rebuild_lineage_graph(objects=[...], check=True)
lineage_split Lineage made of separate networks network info check that no process is missing a link (independent pipelines are expected)
lineage_stops_no_access Lineage stopping at a view whose definition this user cannot read network warning the GRANT named, then rebuild_lineage_graph(objects=[...], check=True)
lineage_stops_unreadable Lineage stopping at a view SHOW VIEW refuses network warning read the message in the finding
process_not_read Process nobody reads (dead end) network info build a dataset on its features, or plan_removal
view_does_not_compile View that does not compile (EXPLAIN fails) network error fix or restore the view (only the root failure is reported)
view_not_verifiable View this user may not EXPLAIN (missing right): not verified network warning the GRANT the finding names
views_not_compiled Views not compiled (over the limit) network info assess a smaller scope
dataset_feature_no_rows Dataset feature with no stored rows dataset_rows error (INNER dataset), warning (FULL OUTER) run the producing process, or rebuild the dataset without the feature
relocation_reverted Relocated feature registered or written in its old table again (older client) dataset_rows error upgrade the older client, then plan_relocation and relocate_features again

Entity keys

Kind What it reports Check Severity Fix
key_column_changes_over_time Entity column that changes over time entity_scan warning (info under 100 entity tuples) store the column as a feature, or remove it from entity_id (suggested key in the finding)
redundant_key_column Entity column determined by the other key columns entity_scan warning (info under 100 entity tuples) register the processes of the entity with the suggested entity_id; keep the dropped column as a feature (remove and register again)
entity_key_superset Entity key containing another entity key entity_layout info run the entity scan; if the extra columns are redundant, register at the smaller key

Order and synchronisation

Kind What it reports Check Severity Fix
ahead_of_upstream Process ahead of its upstream in business time order warning roll the upstream out to that date, then re-run the process with force_compute=True
completed_on_failed_upstream Process completed on a failed or empty upstream order error re-run the upstream, then the process with force_compute=True; use check_upstream=True next time
date_computed_before_earlier_date Business date computed before an earlier date of the same process order warning roll_out(data_domain=..., time_id_start=1, force_compute=True), or the process form
different_time_drivers Dependency between two independent TimeManagers order info unify_time_managers([...], dry_run=True) if they must stay aligned
domains_share_calendar Data domains whose clocks share a calendar order info roll the domains out to the same date
manager_shared_across_domains TimeManager read by several data domains order warning give each domain its processes' own soft clone (align_domain_time_managers or split_time_manager)
mixed_time_modes Dependency between real time and a TimeManager order warning, info drive both ends with one TimeManager
process_not_on_domain_clock Process of a data domain not on the domain clock order warning align_domain_time_managers(domain, process_ids=[pid], dry_run=True)
processes_share_time_filtered_view Processes sharing the domain clock through a view order warning clone_shared_view_time_manager(view, dry_run=True), or move the filter into each process view
ran_before_upstream Process started before its upstream had finished order warning run in dependency order (generate_execution_script), then re-run with force_compute=True
reference_process_left_out Reference process left out of the domain roll-out order info set_process_options(pid, domain_roll_out=True) to put it back
rollout_no_single_calendar No single roll_out covers the data domain order warning set_domain_time_manager(<reference manager>, data_domain=...), then align_domain_time_managers(..., calendars=True)
rollout_refused roll_out of a data domain refuses: a manager on other dates order error align_domain_time_managers(domain, calendars=True, dry_run=True)
upstream_missing_at_date Upstream not computed at the process's business date order warning roll the upstream out over those dates, then re-run the process with force_compute=True
upstream_recomputed_after Upstream recomputed after the process ran order warning roll_out the process over those dates with force_compute=True
calendar_gap Business dates skipped by a catch-up (recorded gap) clock info roll_out(data_domain=..., time_id_start=<first gap>, force_compute=True) once the dates are in the clock, if they matter
clock_behind Domain clock behind its calendar rule clock warning refresh_domain(domain, until='now')
calendar_irregular TimeManager calendar follows no rule clock info tm.set_calendar(Calendar....) with the rule, or keep add_time_steps
calendar_off_rule_dates TimeManager dates that do not fit the stored rule clock warning tm.change_calendar(<rule>, dry_run=True), or tm.set_calendar(<the rule the dates follow>) if the dates are right
calendar_rule_inferable TimeManager calendar: a rule can be stored clock info tm.set_calendar(<the rule shown in the finding>)
fixed_as_of_input TimeManager process reading a fixed-date dataset leakage warning rebuild the dataset with time_manager=
input_other_time_manager Process reading a dataset on another TimeManager leakage warning rebuild the dataset on the process's manager, or unify the two managers
point_in_time_leak TimeManager process reading a current dataset leakage error build_dataset(..., time_manager=<the process's manager>)
fixed_window_bound Window with a fixed literal lower bound windows info keep it if a cumulative read is meant, else read <clock>_PREVIOUS (enable_previous())
hand_written_window Window written by hand from the TimeManager windows info read <clock>_PREVIOUS: d > (SELECT BUSINESS_DATE FROM <clock>_PREVIOUS) AND d <= (SELECT BUSINESS_DATE FROM <clock>)
window_mismatch_calendar Window that does not match the calendar's step windows warning read <clock>_PREVIOUS (see hand_written_window), or change the window to the step of the calendar

Runs and segments

Kind What it reports Check Severity Fix
hollow_run Run that wrote no rows segments info check the source at that date; an empty source may be expected
interrupted_run Run interrupted without recording an outcome segments warning, info close_interrupted_runs(dry_run=True); for a dead run, run(pid, force_compute=True) first
segment_failed FilterManager segment failed at the latest date segments error fix the cause, then run(pid)
segments_missing FilterManager segments not computed at the latest date segments warning run(pid): only the missing segments run
stuck_running Run still marked RUNNING segments warning run(pid, force_compute=True) once the cause is known

Refresh by run() and roll_out()

Kind What it reports Check Severity Fix
external_segment_loop Same business date computed several times by one execution without a FilterManager usage warning declare the segments in a FilterManager (upload_features(..., filtermanager=fm))
external_time_loop Several business dates written by one execution without a TimeManager usage warning attach a TimeManager and replay with roll_out(..., time_id_start=1, force_compute=True)
recursive_query Recursive query in the process SQL usage warning, info take the dates from a TimeManager, sys_calendar.calendar or valid_time_column=; no change if the table is hierarchical
view_rewritten_between_runs Process view rewritten between runs (versions differ only by literals) usage error move the value to a manager: FilterManager for categories, TimeManager for dates
closed_without_flag Entities closed in storage while close_absent_entities is off closed_entities warning set_process_options(pid, close_absent_entities=True) if entities really leave; otherwise find what closes them
validity_gap_without_flag Gaps in entities' validity history while close_absent_entities is off closed_entities warning remove the custom step; close_absent_entities=True if entities really leave, then replay
writes_outside_run Feature tables written outside a run (query log) closed_entities info stop writing to the feature tables directly: close_absent_entities, remove_feature, relocate_features

Process SQL

Kind What it reports Check Severity Fix
history_mixes_versions History computed under several SQL versions sql info if the history must be consistent, roll_out(..., time_id_start=1, force_compute=True)
sql_drift Live SQL different from the stored version sql warning capture_process_sql([pid], dry_run=False), or run the process

Storage layout

Kind What it reports Check Severity Fix
entity_column_type_mismatch Entity column typed differently across tables entity_layout warning cast the column to one type in the process views, register again
storage_skew Storage table skewed across AMPs skew warning check the entity columns of the primary index (a low-cardinality column concentrates rows); entity scan, then another primary_index=
entity_pi_inconsistent Storage tables of one entity with different primary indexes distribution warning one primary_index= for every process of the entity (plan_relocation(primary_index=))
fs_partition_not_on_filter Storage tables not partitioned on the segmentation columns distribution info partitioning= on the segmentation entity column
partition_not_aligned_with_source Partitioning not aligned with the largest source distribution info partitioning= on the entity column
partitioned_source_read_whole Partitioned source read whole by the plan distribution warning with a manager, info without filter the source on its partitioning column with a scalar subquery
pi_not_aligned_with_source Primary index not aligned with the largest source distribution warning when EXPLAIN measures a redistribution, else info the same primary index for the whole entity (re-register, replay)
segment_filter_by_join FilterManager read through a join instead of a scalar filter distribution warning scalar filter on the source's segment column
segment_filter_defeats_pruning Segment filter on the partitioning column that the SQL keeps from pruning distribution warning scalar subquery on the bare partitioning column
segment_filter_not_scalar FilterManager read in another form than a scalar filter distribution warning scalar filter in the view that uses the value
segment_filter_off_hierarchy FilterManager skipping a higher level of the source's partitioning distribution warning add the skipped level to the FilterManager columns, or filter it with the TimeManager in the same view
segments_rescan_source FilterManager segments each reading the whole source distribution warning segment on the source's partitioning columns, if a segment holds every row its computation needs
time_filter_by_join TimeManager read through a join instead of a scalar filter distribution warning scalar filter on the source's date column (a view scored on the ACC needs the join: Error 6881 otherwise)
time_filter_defeats_pruning Business-date filter on the partitioning column that the SQL keeps from pruning distribution warning keep the column bare, put arithmetic on the business date side; cast the scalar to the column's type
time_filter_not_on_partitioning Business date compared with a column the source is not partitioned on distribution info compare the business date with the partitioning column itself
time_filter_not_scalar TimeManager read in another form than a scalar filter distribution warning scalar filter in the view that uses the value
dbc_nearly_full Database DBC nearly full dbc_space warning an administrator purges the query log tables (DBC.DBQLogTbl, ...) or gives DBC more space

Feature values and sensitivity

Kind What it reports Check Severity Fix
feature_values_out_of_range Feature values outside their declared range or allowed values feature_properties warning look at the source, or correct the declared range (feature_properties(features=[...]))
sensitive_feature_in_dataset Dataset exposing a feature declared sensitive feature_properties warning (dataset), info check the dataset's use against the declared reason

What the sanity checks are not

The consistency checks of Inspect & monitor (feature counts, orphans in the storage tables, datasets whose view is stale, processes never run) answer another question: do the catalogs and the storage line up? They have their own kinds and are not in this table. The performance of one process is EXPLAIN scoring and the query optimizer.

See also