Custom check examples
If the built-in metrics that SodaCL offers do not quite cover your more specific or complex needs, you can define your own metrics. See examples to copy+paste.
Set an acceptable threshold for row count delta
checks for dim_product:
- row_delta > {{acceptance_threshold}}:
row_delta query: |
with table1 as (
select count(*) as table_1_rows from {{ table_1 }}
),
table2 as (
select count(*) as table_2_rows from {{ table_2 }}
),
intermediate as (
select
(select table_1_rows from table1) as table_1_rows,
(select table_2_rows from table2) as table_2_rows
),
difference_calculation as (
select
ABS( table_1_rows - table_2_rows)
as row_delta
from intermediate
)
select
row_delta
from difference_calculationFind duplicates in a dataset without a unique ID column
Validate business logic at the row level
Check the sum of column values
Check for incorrectly mapped values across columns
country_name
country_code
Compare dates to validate event sequence
Go further
Last updated
Was this helpful?
