How do I write a custom check with my own SQL?
Define a custom check with a SQL query that should return zero rows. If it returns anything, the run fails, so you can encode any business rule as a check. Bruin does this in one platform: ingestion, SQL and Python pipelines, quality checks, lineage, and an AI data analyst that answers in Slack, Microsoft Teams, Google Chat, WhatsApp, Discord, Telegram, email and the browser.
Command
bruin runDefined in
YAML + SQL
Works with
Bruin CLI + your warehouse
What you get
How it works in code
custom_checks:
- name: no_future_dates
query: SELECT count(*) FROM orders WHERE created_at > now()Run bruin run and the run fails the moment the rule is violated.
Related use cases
Block a pipeline when data quality fails
How do I stop bad data from reaching production tables?
Custom checks and gatesWarn without failing on a soft check
Can I get a warning without failing the whole run?
Custom checks and gatesEnforce a data contract between teams
How do I enforce a schema contract on data another team produces?
Catch bad data before it ships
Bruin CLI and ingestr are on GitHub.
A demo walks through your own data.