A SQL and Jinja formatter for dbt (data build tool) projects. Current stable version is 1.3.0, released in 2020 with low maintenance activity. It formats dbt SQL files containing Jinja expressions (e.g., {{ ref('model') }}) with configurable indentation, uppercase keywords, and newline options. Unlike general SQL formatters (sql-formatter, pgFormatter), it preserves Jinja template syntax without breaking. It is a single-purpose tool, but may lack support for dbt-specific constructs like macros and blocks. Supports only a default SQL dialect; no active support for Redshift, BigQuery, or other databases as of v1.3.0. Minimal dependencies.
npm install dbt-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Formats a dbt SQL string with uppercase reserved words, 2-space indentation, and a trailing newline.
Use `opts.sql = 'default'` or omit the option. Do not expect Snowflake, BigQuery, etc. to be supported.
Consider alternatives like sql-formatter (with Jinja plugin) or write custom formatting.
Avoid using dbt-formatter on models with Jinja blocks (e.g., {% set %}, {% if %}). Strip blocks first or use a different formatter.Set `lowerWords: false` if you need to preserve original casing for identifiers.
Use `import formatter from 'dbt-formatter'` (default import) or `import { format } from 'dbt-formatter'` (named export).Run `npm install dbt-formatter` (or `yarn add dbt-formatter`).
Use `opts.sql = 'default'` or omit the option. No Snowflake-specific formatting will occur.
No dependency data recorded yet.