Skip to content

preset

Presets let teams encode project standards into a shareable YAML file. Use them with dbt-forge init --preset to enforce adapter choices, package selections, and feature flags across multiple dbt projects.

Terminal window
# Validate a preset file
dbt-forge preset validate <path-or-url>
# Use a preset during init
dbt-forge init my_project --preset company-standard.yml

A preset is a YAML file with three sections:

name: "Company Standard"
description: "Standard config for the analytics team"
defaults:
adapter: "Snowflake"
marts: ["finance", "marketing", "product"]
packages: ["dbt-utils", "dbt-expectations", "elementary"]
add_examples: true
add_sqlfluff: true
ci_providers: ["GitHub Actions"]
add_unit_tests: false
add_metricflow: false
add_snapshot: true
add_seed: false
add_exposure: true
add_macro: false
add_pre_commit: true
add_env_config: true
team_owner: "@analytics-team"
locked:
- adapter
- add_sqlfluff
- ci_providers

Optional metadata for the preset. Not used during scaffolding but helps identify the preset when sharing across teams.

Values that override the default prompt selections during init. The user still sees the prompt and can change the value, unless the field is also listed in locked.

Fields listed here skip the interactive prompt entirely and use the value from defaults. Use this to enforce standards that individual users should not change.

Every locked field must have a corresponding entry in defaults. A locked field without a default is a validation error.

These fields can appear in defaults and locked:

FieldTypeDescription
adapterstringWarehouse adapter. One of: BigQuery, Snowflake, PostgreSQL, DuckDB, Databricks, Redshift, Trino, Spark
martslist of stringsMart domains to scaffold (e.g., ["finance", "marketing"])
packageslist of stringsStarter packages from the curated registry
add_examplesbooleanGenerate example staging models and tests
add_sqlfluffbooleanGenerate .sqlfluff and .sqlfluffignore
ci_providerslist of stringsCI providers. Values: "GitHub Actions", "GitLab CI", "Bitbucket Pipelines"
add_unit_testsbooleanGenerate unit test examples (requires add_examples)
add_metricflowbooleanGenerate MetricFlow semantic model example
add_snapshotbooleanGenerate example snapshot
add_seedbooleanGenerate example seed CSV and YAML
add_exposurebooleanGenerate example exposure YAML
add_macrobooleanGenerate example macro
add_pre_commitbooleanGenerate pre-commit hooks and .editorconfig
add_env_configbooleanGenerate .env.example and generate_schema_name.sql
team_ownerstringGitHub team or user for CODEOWNERS (e.g., "@analytics-team")

Unknown fields in defaults or locked cause a validation error.

Terminal window
dbt-forge preset validate company-standard.yml
dbt-forge preset validate https://example.com/presets/standard.yml

Checks a preset file for:

  • Unknown fields in defaults or locked
  • Locked fields that have no corresponding default value
  • Invalid adapter names (must be one of the 8 supported adapters)
  • Invalid CI provider names (must be one of the 3 supported providers)

Exits with code 0 if the preset is valid, code 1 if there are errors.

Example output for an invalid preset:

Preset validation errors:
- Unknown field in defaults: 'warehouse'
- Locked field 'adapter' has no value in defaults
- Invalid adapter: 'MySQL'
Terminal window
# Local file
dbt-forge init analytics_core --preset company-standard.yml
# HTTPS URL
dbt-forge init analytics_core --preset https://example.com/presets/standard.yml
# Combined with --defaults (no prompts shown)
dbt-forge init analytics_core --preset company-standard.yml --defaults

The --preset flag accepts a local file path or an HTTPS URL. The preset is validated before init begins. If validation fails, init exits without scaffolding.

When used without --defaults:

  • Locked fields are skipped entirely — the preset value is used
  • Default fields pre-populate the prompt — the user can change them
  • Unset fields use the normal dbt-forge defaults

When combined with --defaults:

  • Preset values override the built-in defaults
  • No prompts are shown
  • Locked fields behave the same as default fields (both are applied without prompting)
  • Presets only affect the init command. They do not change add, doctor, or status behavior.
  • HTTPS URLs are fetched with Python’s urllib. No authentication is supported.
  • The preset file must be valid YAML. Malformed files cause an error before init starts.
  • Locked fields must have a value in defaults. A locked field without a default is a validation error.
  • The project_name field cannot be set via presets — it is always provided as a CLI argument or prompted.