sqlbuild_project.toml- shared project configuration, committed to version controlsqlbuild_local.toml- local developer overrides, gitignored
sqlbuild_project.toml. Define shared targets such
as dev and prod there, including clone policies and team-wide defaults. Do not maintain
separate complete project files for each environment.
Create sqlbuild_local.toml only when a developer or execution environment needs different
target selection, credentials, schemas, adapter settings, or variables. SQLBuild loads it
automatically and merges its explicitly configured values over the shared project config.
.gitignore:
sqlbuild_project.toml
A complete example:Required fields
Named connections
Define reusable connections under[connections.<name>], then reference one by name from
each target. Connections own endpoint, authentication, and compute settings. Targets own the
authoritative database, schema, variables, and operational policy.
database or schema present in a named connection is connection/session metadata only;
it does not satisfy the mandatory namespace strategy for a named target. Put the target’s
authoritative database and schema on [targets.<name>]. SQLBuild validates connection
references while loading configuration, without opening a warehouse connection, and reports
an unknown targets.<name>.connection name as an offline configuration error.
For migration only, SQLBuild still maps legacy [connection] to an implicit connection and
legacy [targets.<name>.connection] blocks to target-specific implicit connections. These
forms are compatibility syntax, not the canonical format for new or updated projects.
Targets
A target is a named build context - the database and schema you build into, plus execution policy (for exampledev and prod). Each target references a named connection and can configure:
loader_schema, falling back to its model
schema. Managed source reads use the target named by defer_sources_to, or the active
target itself when deferral is omitted. In the example, load --target dev writes to
raw_dev, while models built in dev read from raw_prod.
SQLBuild rejects targets on the same warehouse/database when their managed loader writes
resolve to the same schema. Two targets may read the same schema through deferral, but they
cannot both own loader writes there.
Selecting a target
The active target is determined by (in order of precedence):--targeton the command line (highest priority)sqlbuild_local.tomltargetfielddefault_targetinsqlbuild_project.toml- No target (models build to the default schema)
sqlbuild_project.toml and selects
their normal target once in the optional local file:
dev automatically. An explicit command such as sqb build --target prod
still takes precedence for that invocation.
Clone policies
Targets can declare whether they allow cloning to or from:false. sqb clone --from prod --to dev requires allow_as_clone_origin = true on prod and allow_as_clone_destination = true on dev.
Defaults
Project-wide model defaults. Any field you can set in aMODEL() header can be set here as a default:
MODEL() header.
Constants
Collection constants default to parenthesized SQL value lists. Set a project-wide default when lists and sets should instead compile to first-class adapter-native arrays:collection_rendering accepts value_list (the SQLBuild default) or array. A public constant’s render_as field or a model-local constant(...) wrapper overrides the project setting. The complete precedence order is declaration override, project setting, then value_list.
This setting does not make unsupported adapter features portable. In particular, SQL Server rejects native arrays, and BigQuery rejects nested arrays. See Collections and Rendering for syntax, adapter output, and value-list usage constraints.
Path defaults
Per-directory model defaults. Useful for applying different config to different parts of your project:models/. A model at models/staging/stg_orders.sql matches the
staging path default.
Config layering order
Configuration is layered in this order, with later layers overriding earlier ones:- Project defaults (
defaults) - Path defaults (
path_defaults) - if the model’s path matches - MODEL() header - the model’s own config
tagsare unioned across layers. A model withtags [marts]in its header that matches a path default withtags [managed]will have both tags.row_diff_exclude_columnslists are unioned across layers.row_diff_tolerancesmappings are deep-merged across layers, so a header tolerance for one column adds to (rather than replaces) tolerances declared in defaults or path defaults.
row_diff_sample_rows = 0 explicitly
disables an inherited sample for a path or model. CLI --sample-rows, --sample-seed, and
--exhaustive override the compiled configuration for one invocation.
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.immediate: Creates the table directly at the target location. Audits run after materialization. Simpler but no pre-promotion safety net.
Rules
Rules configuration belongs in the sharedsqlbuild_project.toml so local and CI compilation use
the same checks:
SQBR; repository-defined codes begin with XSQBR. See
Compiler-integrated Rules for configuration, authoring, and suppressions.
Project variables
Variables are simple string substitutions available in model SQL via the@@name syntax:
Janitor
Configuration for thesqb 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:
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 optional file is loaded automatically and should be gitignored. Only put values that differ from the shared project configuration here.
Project and local configuration merge named connections by name and merge their explicitly
configured fields. Target blocks merge the same way and may override the connection reference,
database, schema, loader_schema, variables, source deferral, and policy fields. Unspecified
values continue to come from sqlbuild_project.toml; a local reference to an unknown merged
connection still fails offline during configuration loading.
This replaces the common dbt pattern of switching profiles or setting environment variables
to change targets. Each developer sets their target, named connection, and preferences once in
sqlbuild_local.toml and it persists across sessions.
