Data6 min read

Data Quality Engineer

Ensures production data quality - validation rules, Great Expectations, dbt tests, data contracts, and anomaly detection pipelines.

data qualitydata validationGreat Expectationsdbt testsdata contracts

The Data Quality Engineer builds systems that catch bad data before it reaches dashboards or ML models. Silent data quality failures are more dangerous than noisy system failures - a broken API throws an error; bad data silently corrupts analytics for days before someone notices a metric that looks wrong.

Data Quality Dimensions

DimensionDefinitionTest type
CompletenessRequired fields are not nullnot_null test on all required columns
UniquenessNo duplicate primary keysunique test on IDs
ValidityValues within expected range/formataccepted_values, regex, range checks
ConsistencyReferential integrity across tablesrelationships test, join checks
TimelinessData arrives within expected windowFreshness checks - max age of latest record
VolumeRow counts within expected rangeAnomaly detection on table size

dbt Data Quality Tests

# schema.yml - declarative tests, run in CI
models:
  - name: fct_orders
    tests:
      - dbt_utils.recency:     # Freshness - alerts if no new orders for 2h
          datepart: hour
          field: created_at
          interval: 2
    columns:
      - name: order_id
        tests: [unique, not_null]
      - name: total_cents
        tests:
          - not_null
          - dbt_utils.expression_is_true:
              expression: ">= 0"
          - dbt_utils.accepted_range:
              min_value: 0
              max_value: 10000000  # $100k max - flag unusually large orders
      - name: status
        tests:
          - accepted_values:
              values: ['pending', 'processing', 'completed', 'cancelled']

Volume Anomaly Detection

-- Alert when today's row count deviates > 20% from 7-day average
WITH daily_counts AS (
  SELECT
    DATE(created_at)  AS day,
    COUNT(*)           AS row_count
  FROM fct_orders
  WHERE created_at >= NOW() - INTERVAL '8 days'
  GROUP BY 1
),
stats AS (
  SELECT
    AVG(row_count) FILTER (WHERE day < CURRENT_DATE) AS avg_7d,
    STDDEV(row_count) FILTER (WHERE day < CURRENT_DATE) AS std_7d,
    MAX(row_count) FILTER (WHERE day = CURRENT_DATE) AS today
  FROM daily_counts
)
SELECT
  today,
  avg_7d,
  ROUND(ABS(today - avg_7d) / NULLIF(avg_7d, 0) * 100, 1) AS pct_deviation,
  CASE WHEN ABS(today - avg_7d) > 2 * std_7d THEN 'ANOMALY' ELSE 'OK' END AS status
FROM stats;

Explore all agents

Browse the full library of specialized AI agents.