Skip to main content
This guide walks you through creating and running a complete transformation project - views, tables, incremental models, audits, tests, and a custom materialization - all running locally against DuckDB. No external data setup or warehouse credentials required.

Prerequisites

  • Python 3.12+
  • SQLBuild installed: uv pip install sqlbuild or pip install sqlbuild

1. Create the playground

This creates a self-contained waffle shop project with everything you need to explore SQLBuild.

2. Plan

Preview what SQLBuild will do:
Source data is defined as inline expressions in sources/raw.yml, so SQLBuild resolves everything at compile time - no seeding step needed.

3. Build

Execute the full build:
SQLBuild materializes all models in DAG order. SQL unit tests run before their target models. Error-severity audits run against a staging table before promotion - if any fail, the production table is untouched:
Notice audit (d) and audit (f) on incremental models - these are delta-phase and final-phase audits. Delta audits validate each batch before DML is applied; final audits run against the target after promotion.

4. Verify

Run the plan again to see the steady-state:
All models now show Normal instead of First run.

5. Common operations

What you just built

Model DAG

Materialization types

The project demonstrates several materialization strategies:
  • Views (stg_customers, stg_orders, stg_payments) - lightweight staging layer
  • Tables (fact_orders, dim_customers, daily_revenue) - full table rebuilds
  • Merge incremental (customer_status_snapshot) - upsert with timestamp cursor
  • Delete/insert incremental (hourly_order_activity, daily_activity_rollup, hourly_activity_with_daily_context) - microbatch processing with configurable batch sizes
  • Integer cursor incremental (order_status_index) - non-timestamp incremental
  • Custom materialization (daily_order_partitioned) - Python-defined partition-tracked strategy
See Incremental for details on cursor-based strategies and microbatch processing.

Project structure

Next steps

  • Models - understand MODEL() headers and materialization types
  • Functions - SQL UDFs, Python UDFs, and table functions
  • Incremental - learn about cursor-based incremental strategies
  • Audits - configure data quality checks
  • Testing - write SQL unit tests with chaining and macro support
  • Column Lineage - trace individual columns through your pipeline
  • CLI Reference - full command reference