Data quality testing
incident.io runs data quality tests with dbt's native testing and tackled two problems: flaky relationship tests and slow debugging of failures. Relationship tests failed spuriously because transformations ran mid-ingestion, so a child table could reference rows not yet loaded into its parent. The fix overrides dbt's should_store_failures, relationships and get_test_sql macros so a missing foreign key only fails when it recurs across two consecutive hourly runs. For debugging, a Python step parses run_results.json and manifest.json to find failed tests and their stored-failure tables, then sends ready-made SELECT queries in the incident API payload so responders can see failing rows directly.
Related posts
- Updating our data stack
incident.io mediumAdeptincident.io's two-person data team reworked its BigQuery/dbt analytics stack as the company grew from 10 to 30 people. Fivetran moved to a separate BigQuery project after dbt tests in CI timed out because concurrent interactive queries exceeded BigQuery's 100-query quota. A CircleCI queue orb now serialises overlapping dbt runs that were creating and dropping the same tables. Unreliable GOOGLEFINANCE FX rates were replaced with a version-controlled seed plus a daily APILayer pull, checked by uniqueness and gaplessness tests. Models now materialise as tables rather than views, intermediate models sit between staging and fact/dimension models to avoid duplicated logic, SQLFluff enforces formatting, and Metabase folders separate sandbox work from locked-down core dashboards.
- Data stack 2024
incident.io mediumAdeptincident.io's 2024 data stack runs Fivetran and Segment into BigQuery, dbt (run via Docker on CircleCI) for transforms, and Hightouch for reverse ETL. Analysis is split across Omni for internal BI, Explo for customer-facing embedded insights, and Hex for ad-hoc notebook work. Omni was chosen for its layered schema, shared and workbook models, which balance governance with flexibility. Local dbt development got faster by uploading each production manifest.json to GCS and wrapping `--defer --state` in bash aliases. Data pipeline failures, including flaky retries, now declare incidents and page responders automatically through incident.io's own On-call product, with urgency based on customer impact.
- Battling database performance
incident.io mediumAdeptIntermittent API timeouts at incident.io over two weeks traced back to requests blocking on Go's database/sql client-side connection pool, with no single slow query or pool to blame. The team shipped 24 changes along the way. These included materialised views, new indexes, query rewrites, a one-second lock timeout on transactions, and moving Slack webhook handling onto PubSub. They also built per-operation tracking of connection-hold time using an ngrok/sqlmw middleware and context counters that avoid double-counting inside transactions. The root cause turned out to be an unnecessary transaction wrapped around every Slack modal submission. Many short transactions added together had exhausted the pools, and removing it ended the timeouts.
- PostgREST v10: EXPLAIN and Improved Relationship Detection
Supabase mediumAdeptPostgREST v10 adds HTTP-level EXPLAIN support: requests with the `application/vnd.pgrst.plan` media type, or supabase-js's `explain()` transform, return the PostgreSQL execution plan for reads, writes and RPC, which helps verify that RLS policies are applied and gives you the pg_stat_statements query identifier. Relationship detection also improves. One-to-one relationships are inferred from unique or primary keys on foreign keys, and "computed relationships" use inlinable SQL functions to define joins on views and materialized views that lack foreign keys. A breaking change now requires a join table's primary key to include both foreign key columns before it is detected as many-to-many. EXPLAIN is gated behind `db-plan-enabled` and intended only for development.
- How we systematically improved our reliability
Neon mediumAdept
After two control-plane incidents in one week, each triggered by an external dependency failure that turned into a self-reinforcing loop, Neon rebuilt how it runs reliability for Lakebase Postgres across 70+ cells on three clouds. Postmortems now start with quantified impact, track detection and mitigation times, and use branching 5 Whys trees that end in specific, closable action items. The fixes, more than 30 over three months, covered query-plan regressions and long-running transactions in the control-plane Postgres, inherited TCP timeout and connection-pool defaults, and broken backpressure and fairness under load. To catch failures before they reach customers, each change now gets a risk score (probability × impact) that sets how many checks it must pass across design, build, release and operate, including premortems, rollback tests, staged rollouts and on-call drills.