Data quality checks
Data quality checks are rules you declare on a dataset: this column is never empty, this key is unique, this temperature sits between −40 and 10 °C, this feed is never more than 20 minutes old. The pipeline engine evaluates them on every build, before the new version is published. A failing check either raises a warning or blocks the build, so bad rows never reach the objects people and agents act on
- Editor role on the pipeline's project to add or change checks, through the same review as pipeline code, and Owner to override a blocked build
- The access labels on the dataset, to read its quarantine table and failing rows
- A pipeline that produces the dataset; checks run on builds, so a raw dataset written only by a connector has none of its own
- An alert route to a group, email or a webhook if failures should reach someone outside the console
In the platform today
- Checks run in the platform service with tests, on each step of a pipeline in
pipelines.yaml - A check has a
nameand eitherrow, a SQL predicate every output row must meet, orcheck, a predicate over the whole output, andonFail:warnkeeps the rows and records a warning,dropremoves the failing rows and keeps them inops.quarantine, andfailstops the build withBUILD_BLOCKED - A build publishes all of its outputs or none, so a failed build leaves every output of the pipeline on its last good version
- Shorthand
checks:(primaryKey,rowCount,notNull,values) add checks without SQL, and schema contracts hold a step's output and inputs to a baseline schema - Quarantined rows are listed, replayed with a fix or discarded through
/api/v2/quarantine - Every result is a row in
ops.quality_resultswith the run, dataset, check, outcome and failing row count, and a what-if lists the checks an action would newly fail - Freshness and volume between builds are watched by dataset health, on a timer when a monitor watches datasets
- Typed checks, severities and tolerances, a quarantine table per dataset, overrides, and issues and alert routes per check
Shorthand checks
A step's checks: is a list of one-key mappings, each with an optional onFail, or one mapping with every check at its default. They run after the step's own expectations, under the same rules, and their results are in ops.quality_results under generated names such as "Primary key shop, day"
| Check | Holds when | Kind |
|---|---|---|
{ primaryKey: [shop, day] } | One row per key and no empty key column | Whole output; fail or warn |
{ rowCount: { min: 1, max: 100000 } } | The output's row count is in range; either bound is optional | Whole output |
{ notNull: [shop, day], onFail: drop } | Every row has these columns | Row; fail, warn or drop |
{ values: { status: [Open, Closed] } } | The column holds only these values or nothing | Row, one per column |
The default onFail is fail
Schema contracts
contract: on a step holds its output's columns to a baseline, and inputContracts: { raw.x: mode } holds an input as this pipeline reads it. The baseline is the schema seen at the first successful build under the contract
| Mode | Holds when |
|---|---|
exact | The same columns, in the same order, with the same types |
exactAnyOrder | The same columns with the same types, in any order |
additions | Every baseline column stays with its type; new columns are allowed |
additionsKept | As additions, and a column once added joins the baseline, so it must stay too |
A violation stops the build before anything is published, with reason OUTPUT_CONTRACT or INPUT_CONTRACT and the columns in the message. An editor accepts the new schema as the baseline with POST /api/v2/schema-contracts:accept ({ dataset, pipeline, role: output | input }). Every schema change any build sees, added, removed, retyped or reordered, is recorded once in ops.schema_changes with the pipeline, the run and the contract it broke, and listed by GET /api/v2/schema-changes. Spark steps write their own output, so only their inputs are held to a contract
How checks gate a build
A pipeline build never writes directly to the version that readers see. It evaluates every check on the build's output and publishes only once every step has passed, and the sync service then picks the new version up. A failed check means nothing is published: the dataset, and every object it backs, stays on the last version that passed
Checks run at two levels. Row checks, row, notNull and values, apply to every output row, and failing rows can be dropped to ops.quarantine. Output checks, check, primaryKey and rowCount, run on the whole result
Typed checks
On request, typed checks such as ranges, accepted values, patterns and references, with tolerances so a few noisy rows do not stop a build, kept in a file beside each pipeline
Warn, drop or fail
onFail says what a failed check does to the build. Choose it by asking what happens downstream if a bad version is published. If a planner might reroute a truck or release a batch on the strength of the value, fail. If the value is informational, or a stale value is worse than a slightly wrong one, warn. On request, a third severity that only records results, and a blocked build keeps its candidate for inspection
In the platform service today, a scheduled pipeline that reads from one whose build failed in the same pass is skipped, with the reason in its schedule state and the audit log, and runs again once its trigger next fires. On request, an Owner can override a failed build once, with a written reason in the audit log
Quarantine
In the platform service today, rows removed by onFail: drop, or by a shorthand check that drops, are kept in ops.quarantine with the pipeline, dataset, check, run and the row as JSON, at most 10,000 rows per check per build. The same row dropped again by later builds stays one entry, with its last run and count moved on. An entry is held until someone acts; replay once an editor sends a fixed row, which every later build puts in place of the bad one, before the checks run, for as long as the source still makes the bad row; resolved once the source no longer makes it; or discarded. Listing, replaying and discarding need the pipeline's editors or an administrator, and the access label of the object type the dataset backs
{ "items": [ { "id": "q_3f9a1c07e2…", "set": { "freezerTemp": -21.5 } } ] }
{ "ids": ["q_3f9a1c07e2…"], "reason": "Test sale from the training till" }
The Quality tab of the Pipelines screen lists a pipeline's quarantined rows. Fix and replay opens the row's values in place and sends only the ones you change; Discard asks for a reason in place. The same tab shows the pipeline's schema contracts, whether each holds, and Accept new schema for one that is broken
On request, failing rows kept in a quarantine table beside each dataset, with the reason and status of each row
Freshness and row-count drift
Freshness and drift catch the failures that row checks cannot: a feed that stopped, a partial extract, a filter that quietly dropped a region. Today rowCount holds a build to fixed bounds, and dataset health watches freshness and volume between builds. On request, freshness and drift checks compare each build with its recent history, so a stopped feed or a partial extract is caught before it reaches objects
Referential checks
On request, a referential check says every value in a column must exist as a key in another dataset or as the primary key of an object type
Referential checks matter most for datasets that back link types. A delivery row that names a shop that does not exist produces an orphan link: the delivery object exists, but the traversal from the shop never finds it. A referential check on shopId catches this at build time
Alerts and issues
On request, a failed check opens one issue per dataset and check, sent to a group, email or webhook with quiet hours
Reading results
In the platform service today, results are read from ops.quality_results, a table you can query like any other dataset, and quarantined rows from GET /api/v2/quarantine
-- Expectations that failed most often in the last 30 days, by pipeline
SELECT pipeline_id, dataset, expectation, on_fail, COUNT(*) AS failures
FROM ops.quality_results
WHERE NOT passed AND checked_at > current_timestamp - INTERVAL 30 DAYS
GROUP BY pipeline_id, dataset, expectation, on_fail
ORDER BY failures DESC
LIMIT 20;
Limitations
- Checks run when a pipeline builds; between builds, freshness and volume are watched by dataset health
- A failed build holds every scheduled pipeline downstream of it in that pass, so one failing check can leave several object types stale until a build passes
- Quarantine applies to row checks only; output checks such as
primaryKeyandrowCountcan only warn or fail - Renaming a check starts a new history in
ops.quality_results - Checks catch values that break a rule you wrote; they do not catch values that are wrong but plausible