Skip to main content
SQLBuild projects are configured with two files in the project root:
  • sqlbuild_project.toml - shared project configuration, committed to version control
  • sqlbuild_local.toml - local developer overrides, gitignored

sqlbuild_project.toml

A complete example:

Required fields

Connection

The connection block is passed directly to the adapter. For DuckDB:
Targets can override the connection:

Targets

A target is a named build context - the schema, database, or connection you build against (for example dev and prod). Targets let you build to different places from the same project. Each target can override:

Selecting a target

The active target is determined by (in order of precedence):
  1. --target on the command line (highest priority)
  2. sqlbuild_local.toml target field
  3. default_target in sqlbuild_project.toml
  4. No target (models build to the default schema)

Clone policies

Targets can declare whether they allow cloning to or from:

Defaults

Project-wide model defaults. Any field you can set in a MODEL() header can be set here as a default:
These apply to all models unless overridden by path defaults or the model’s own MODEL() header.

Path defaults

Per-directory model defaults. Useful for applying different config to different parts of your project:
Path matching uses the model’s relative file path. A model at models/staging/stg_orders.sql matches the models/staging path default.

Config layering order

Configuration is layered in this order, with later layers overriding earlier ones:
  1. Project defaults (defaults)
  2. Path defaults (path_defaults) - if the model’s path matches
  3. MODEL() header - the model’s own config
Most keys are overridden by the more specific layer, but three merge instead:
  • tags are unioned across layers. A model with tags [marts] in its header that matches a path default with tags [managed] will have both tags.
  • row_diff_exclude_columns lists are unioned across layers.
  • row_diff_tolerances mappings are deep-merged across layers, so a header tolerance for one column adds to (rather than replaces) tolerances declared in defaults or path defaults.

Settings

Global feature toggles:

Table promotion mode

  • staged (default for most adapters): Materializes into a staging table, runs audits, then swaps into the target. If audits fail, the production table is untouched.
  • direct: Creates the table directly at the target location. Audits run after materialization. Simpler but no pre-promotion safety net.

Project variables

Variables are simple string substitutions available in model SQL via the @@name syntax:
Target-specific variables override project-level ones:
See Macros for details on variable substitution and how variables interact with macros.

Janitor

Configuration for the sqb janitor command, which cleans up stale warehouse relations:

Scenario

Configuration for scenario snapshot capture safety limits and local type overrides:
Local type overrides for DuckDB replay are configured per adapter dialect:
See Scenarios for details on local type overrides and capture limits.

dbt

Configuration for running SQLBuild alongside an existing dbt project:
Paths can be absolute or relative to the SQLBuild project root. See Using SQLBuild with dbt for setup and usage details.

Skills

Configuration for AI agent skill file installation:
See skills CLI reference for usage details.

sqlbuild_local.toml

Local developer overrides. This file should be gitignored.
This replaces the common dbt pattern of switching profiles or setting environment variables to change targets. Each developer sets their target, connection, and preferences once in sqlbuild_local.toml and it persists across sessions.