Skip to content

Checks and severity

View as Markdownllms.txt

This document describes the validation checks implemented in Floe, the supported column types for casting, and how policy.severity applies to each check. For the full execution order (file-level vs row-level vs entity-level), see How Floe works.

  • Trigger: schema.columns[].nullable: false
  • Logic: a row fails when the typed value is null.
  • Notes:
    • Nulls include explicit nulls and any values listed in source.options.null_values.
    • Applies to every column with nullable: false.
  • Trigger: schema.unique_keys (each entry is one single- or multi-column key) and/or schema.primary_key (enforced as one more composite key).
  • Logic: the first occurrence is accepted; any later duplicate values are flagged.
  • Notes:
    • Null values are ignored (they do not count as duplicates).
    • Applies independently per key, across all input files in the entity.
    • The legacy schema.columns[].unique flag was removed in 1.0: floe validate and floe run fail on it. Use schema.unique_keys, e.g. unique_keys: [[order_id]].
  • Trigger: any column whose logical type is not string.
  • Logic: a row fails when the raw value is present but the typed value is null.
  • Notes:
    • In cast_mode: strict, cast errors are reported.
    • In cast_mode: coerce, cast errors are ignored (values become null and may still fail not_null if the column is required).

Value checks: out_of_range, not_allowed, pattern_mismatch, length

Section titled “Value checks: out_of_range, not_allowed, pattern_mismatch, length”

Optional keys on a column, each checked on the typed value:

Keys Rule Column types A row fails when
min, max out_of_range int, float, decimal, date, datetime the value is below min or above max (both inclusive); NaN always fails
allowed_values not_allowed int, string the value is not in the list
pattern pattern_mismatch string the value does not match the whole pattern
min_length, max_length length string the number of characters (Unicode code points) is outside the bounds
columns:
- name: amount
type: decimal(18,2)
min: 0
max: "99999999.99" # quote exact decimals
- name: order_date
type: date
min: "2000-01-01"
- name: country
type: string
allowed_values: [FR, DE, US]
pattern: "[A-Z]{2}" # full match: Floe adds the anchors
min_length: 2
max_length: 2
  • Bounds and allowed_values are converted like a value of the column: a bound accepts exactly what a CSV value of that column does (ISO date, ISO datetime normalised to UTC, exact decimal).
  • A null passes every value check (nullable decides nulls), and a value that failed its cast is not reported again.
  • pattern uses the Rust regex syntax that Polars runs, never Python re.
  • Error order on a row: not_null, cast_error, out_of_range, not_allowed, pattern_mismatch, length, unique. Messages carry the config values only, never the row’s value.
  • floe validate refuses a key on a column type it does not apply to and min above max (config_conflict), and a bound or allowed value that does not convert, a NaN or infinite bound, and a pattern that does not compile (config_invalid_value).
  • Trigger: an entry of schema.checks, which compares a column with another column (right) or a literal (value), optionally only on the rows where a when condition holds.
  • Logic: a row fails when the comparison is false on its typed values.
  • Notes:
    • A comparison or when that involves a null passes the row, as in SQL CHECK; use is_null or not_null to test for missing values. A row whose when is false passes.
    • The row error has rule = the check name, column = left, and a message rendered from the config (end_date >= start_date, amount == 0 when status == cancelled). In validation.rules[] each predicate is listed under its own name, after the column value rules.
    • severity sets the level of one predicate; without it the predicate uses policy.severity.
    • No and/or, nesting or arithmetic: one comparison and at most one when per check. Field rules are in the config reference.
policy:
severity: reject
schema:
columns: [...]
checks:
- name: end_after_start
left: end_date
op: ge # eq ne lt le gt ge, is_null not_null
right: start_date # a column
- name: discount_within_amount
left: discount
op: le
right: amount
severity: warn # keep the row, count a warning
- name: vat_needs_country
when: {left: vat_id, op: not_null}
left: country
op: not_null
- name: no_cancelled_with_amount
when: {left: status, op: eq, value: cancelled} # a literal
left: amount
op: eq
value: 0

Type names are case-insensitive and normalized by removing - and _. Examples of accepted values are listed below.

  • string: string, str, text
  • boolean: boolean, bool
  • integer:
    • int8, int16, int32, int64
    • int, integer, long
  • unsigned integer:
    • uint8, uint16, uint32, uint64
  • number (float64):
    • number, float64, float, double
  • decimal(p,s) (exact; see Supported column types)
  • float32: float32
  • date: date
  • datetime: datetime, timestamp

The configured policy.severity applies uniformly across all checks:

  • warn
    • Rows are kept.
    • Errors are logged for each failed check.
  • reject
    • Rows with any check failure are rejected.
    • For unique, the first occurrence is kept, duplicates are rejected.
  • abort
    • Any check failure aborts the entire file (file-level rejection).

All modes avoid logging raw row values; only rule, column, row index, and message are emitted in reports.

policy.severity is the default. A rule can override it, on one column (schema.columns[].rule_severity: not_null, cast_error, out_of_range, not_allowed, pattern_mismatch, length) or for the whole entity (policy.rule_severity: the column rules as defaults, plus unique and schema_mismatch). The level of a check is the column’s entry, else the entity’s, else policy.severity.

policy:
severity: reject # default for every check
rule_severity:
schema_mismatch: warn # a requested reject_file only warns and fills nulls
unique: abort # a duplicate key aborts the entity
schema:
mismatch:
missing_columns: reject_file
primary_key: [order_id]
columns:
- name: order_id
type: int64
- name: amount
type: decimal(18,2) # cast_error -> reject (the default)
- name: email
type: string
nullable: false
rule_severity:
not_null: warn # a missing email keeps the row and counts a warning

A row is rejected if any failed check resolves to reject or abort; a row that only fails warn checks is kept and counted as a warning. Any abort-level failure aborts the file. sink.rejected is required as soon as any rule can resolve to reject or abort, and abort is refused with pii. unique is one rule for every key: severity per key is not supported.

  • Row-level rejection is the default because it preserves good data while isolating bad rows.
  • unique is dataset-level and enforced by policy.severity:
    • warn: log duplicates and keep all rows.
    • reject: keep the first occurrence, reject duplicates.
    • abort: abort the file if duplicates are found.
  • In append mode, unique checks seed from existing accepted data for the supported accepted sinks, so duplicates across runs can be rejected.
  • cast_mode defines parsing behavior:
    • strict: invalid values cause rejection (or abort per policy).
    • coerce: invalid values become null; nullable rules decide acceptance.

Synced from floe @ v1.1.0 (313b534), docs/concepts/checks.md.