Case study: a tested transformation layer on Snowflake
repository ↗Raw sample data (jaffle_shop customers and orders, stripe payments) landed in Snowflake with no shared definitions. The goal: a version-controlled transformation layer where every table is documented, tested and rebuilt from one command.
Two databases: raw for landed data, analytics for dbt output. Sources declared in YAML, one staging model per source table (stg_customers, stg_orders, stg_payments) that renames and types columns, then two marts: dim_customers and fct_orders at one row per customer and one row per order.
unique and not_null tests on every source and model key, order status documented as a markdown doc block so the accepted values are explicit. A failing test stops the build before the marts are rebuilt.
Kimball-style dim and fact tables over one wide table: slower to write, but customer lifetime metrics and order metrics keep separate grains, so a payment fix never double counts an order.
Slim CI on pull requests (build only changed models), a snapshot for order status history, and an incremental strategy for fct_orders once the volume justifies it.