Concepts
Checks before publish
unique, not_null, min_rows and max_row_drop: checks on the rows a load has staged, which stop bad rows before they reach the table.
A table’s checks run on the rows a load has staged, before they reach the table. A failed check
fails the table, and none of the commit’s rows are published.
[sources.app.tables."public.customers"]description = "Customers, one row per customer."write_strategy = "replace"
[sources.app.tables."public.customers".checks]unique = ["customer_id"]not_null = ["customer_id", "email"]min_rows = 1max_row_drop = "20%"| Check | Passes when | Strategies |
|---|---|---|
unique |
No two rows share these columns’ values. Rows with a NULL in them are skipped; add the columns to not_null to forbid NULLs. |
All |
not_null |
None of these columns holds a NULL. | All |
min_rows |
At least this many rows are loaded. | replace |
max_row_drop |
The table loses at most this whole percentage of its rows, from "0%" to "100%". Not checked on the first load. |
replace, and merge with deletes, where it caps what a key scan marks (5% by default) |
warn |
Lists checks above that only log their failure and publish anyway, such as warn = ["max_row_drop"]. It can name only checks the table sets. |
When a check fails
Section titled “When a check fails”The table’s error names each failed check, with counts, and up to five repeated keys for unique.
The table keeps what it held:
checks.unique failed: 1 value of (customer_id) appears in more than one row, such as (2); nothing was publishedEach commit is checked by itself. Under append, merge and delete_insert, which commit batch
by batch, a failing batch leaves the batches before it in place, and the message says how many rows
they published. min_rows and max_row_drop describe the whole table, so plan refuses them
under these strategies, except as above.
Where checks apply
Section titled “Where checks apply”- A source’s
checksapply to all its tables. A table’s ownchecksreplaces the whole block. - Python tables take
checks=. - Named columns must be loaded columns, matched ignoring case;
planfails otherwise. - Tables with checks always stage their rows. A files source the destination would read directly
goes through SQLLoad instead, which is slower, and
planwarns. - Files targets and
postgres_cdcsources take no checks.