Skip to content
Rules and checks

Rules and checks

A rule groups one or more checks under a stable code. Examples: rules cookbook.

Rules

FieldMeaning
codeStable, unique across rules and dataset_rules; INGEST_* is reserved
levelerror or warn
columnDefault column; a check’s column/columns overrides it
checksMapping of check name to arguments, e.g. not_null: true, valid_values: [A, B]; see syntax
whenOptional condition
message, nameShown for failures; stored once in rules.json

Levels

LevelRow bucketBlocks (exit 1)
errorerrorYes
warnwarnNo; exit 0 allows warnings

Check scopes

ScopeChecksNotes
rownot_null, valid_range, matches_pattern, type_check, …Each row independently
globalis_unique, is_unique_compositePrepass + replay; every duplicate, including the first, fails
referencereferential_integrity, referential_integrity_compositeProbe an index built from a reference file
schemarequired_columns, schema_matches, valid_schema_columnsOne dataset-wide outcome
datasetdataset_rulesAggregate metrics, see below

Conditions

when applies to row and reference checks.

when:
  all:
    - {column: status, operator: eq, value: PAID}
    - {column: refunded, operator: eq, value: false}
  • Leaf: column, operator (eq, ne, lt, le, gt, ge, in, is_null, is_present), value.
  • Compose with all, any, not.
  • False condition → rule not applicable; invalid operand → unevaluable.

Row buckets

BucketRow has
passNo failures
warnOnly warn-level failures
errorAny error-level failure or ingestion issue

total = pass + warn + error.

Ingestion issues

Raised while reading and converting; always error severity.

CodeCause
INGEST_TYPEValue cannot convert to the declared type
INGEST_NULLNull in a nullable: false column
INGEST_MISSING_FIELDrequired: true field missing
INGEST_EXTRA_FIELDUndeclared JSON field with extra_fields: error
INGEST_MALFORMEDCSV row with wrong field count, on_malformed: reject
INGEST_SCHEMASchema scope: required column absent, type mismatch, undeclared or inconsistent column

Checks on an invalid cell count as unevaluable rather than null.

Dataset rules

dataset_rules:
  - code: DATASET_NOT_EMPTY
    level: error
    metric: row_count
    min: 1
Metric familyExamples
Row countrow_count
Missing/null/blank/conversioncounts and fractions, e.g. null_fraction
Rule failurescounts and fractions
Numericsum, min, max, avg