Skip to content
Automatizav1
SRV-03 · ANALYTICS ENGINEERING

Modeling, tests, and docs as code

Analytics engineering is an engineering discipline. Everything versioned, reviewed, tested.

APPROACH

Approach

We operate on the modern stack: dbt for transformations, an orchestrator (Airflow or Dagster), tests in CI, and a metric glossary treated as living documentation. Every pull request ships a preview and an impact plan.

Clear layers: staging isolates sources, intermediate builds reusable blocks, marts ship models ready for BI and reverse-ETL.

Mandatory code review. No model grows without owner and tests.

Docs generated from the code, not written aside: if the model changes, the doc changes.

TESTS · DOCS

Tests & docs

  • T-01Schema tests (unique, not_null, relationships) on every critical table
  • T-02Contract tests on marts: breaking changes fail CI
  • T-03Freshness tests per table SLA
  • T-04Docs generated via dbt-docs with full lineage
  • T-05Exposure tracking: every dashboard linked to its source model
EXAMPLE · MART

How a mart actually looks

A typical revenue mart with an enforced contract, a 2-day late-arrival window, and an incremental key. Every PR runs the contract test; a breaking change fails CI.

fct_revenue.sqlSQL
0
{{
  config(
    materialized = 1,
    unique_key   = 2,
    on_schema_change = 3,
    contract     = { 4: true }
  )
}}

WITH paid AS (
  SELECT
    date_trunc(5, order_ts) AS period,
    customer_id,
    SUM(amount_cents) / 100.0   AS revenue_usd
  FROM {{ ref(6) }}
  WHERE status = 7
  {% if is_incremental() %}
    AND order_ts >= (SELECT max(period) - interval 8 FROM {{ this }})
  {% endif %}
  GROUP BY 1, 2
)

SELECT
  period,
  COUNT(DISTINCT customer_id) AS customers,
  SUM(revenue_usd)            AS revenue_usd
FROM paid
GROUP BY period;
GLOSSARY · EXAMPLE

Metric glossary

Every project starts with an agreed glossary. We keep a public example so you can see the format.

Open glossary

Wire a real pipeline to your warehouse

30-min stack review. We come back with a scoped plan, an owner, and a freshness contract. No SDR, no slide deck.