sqlfluff-templater-dbt
Lint your dbt project SQL
What it is and what it does
sqlfluff-templater-dbt is a plugin that extends SQLFluff's linting capabilities to work with dbt projects. It allows SQLFluff to parse and lint dbt template syntax—Jinja2 expressions, dbt macros, and ref() calls—by rendering them through dbt's templating engine before analysis. This bridges the gap between dbt's SQL generation and SQLFluff's dialect-aware linting, letting you enforce SQL style and correctness rules across your entire dbt project.
The plugin is designed for teams using dbt for ELT workflows who want to maintain consistent SQL quality and formatting standards. It integrates dbt-core and jinja2-simple-tags to handle template resolution, then applies SQLFluff's linting rules to the rendered output. You can use it to auto-fix formatting issues, catch SQL errors, and enforce organizational style guides on dbt-generated SQL.
Use it for:
- Enforce SQL formatting and style standards across a dbt project's models and tests.
- Auto-fix spacing, indentation, and syntax issues in dbt SQL before deployment.
- Catch SQL dialect-specific errors in dbt models targeting Snowflake, BigQuery, or other databases.
- Integrate dbt SQL linting into CI/CD pipelines to gate model deployments on code quality.
- Validate dbt macros and templated SQL for consistency across teams.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Enables SQLFluff to lint and auto-fix dbt project SQL using dbt templating, integrating dbt-core and Jinja2 template processing into SQLFluff's multi-dialect SQL linting workflow.
Yes, if you use dbt and want to lint your project's SQL. The plugin is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and integrates cleanly with SQLFluff's existing multi-dialect support. Install it when you need to enforce SQL quality standards on dbt-generated code.
Install
sqlfluff-templater-dbt on PyPI
pip
pip install sqlfluff-templater-dbtuv
uv add sqlfluff-templater-dbtpoetry
poetry add sqlfluff-templater-dbtInstalling sqlfluff-templater-dbt
Before you install
Low install friction with a pure-Python wheel. Actively maintained with a release 7 days ago and 9853 GitHub stars. Requires sqlfluff, dbt-core, and jinja2-simple-tags as runtime dependencies.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects alike.
Quickstart
pip install sqlfluff-templater-dbt
from sqlfluff.core import Linter
linter = Linter(dialect='snowflake', templater='dbt')
result = linter.lint_string('SELECT * FROM {{ ref("my_model") }}')
Requires dbt-core to be installed and a valid dbt project structure with dbt_project.yml present for template resolution.
Verify before relying
- Specific dbt versions or configurations required for full compatibility with this templater plugin.
- Whether the templater supports all dbt features (macros, packages, custom tests) or has known limitations.
- Performance characteristics when linting large dbt projects with many models and dependencies.
Package facts
| License | MIT License Copyright (c) 2018-2026 Alan Cruickshank Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),… (full text in the JSON record) (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — sqlfluff, dbt-core, jinja2-simple-tags |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,717,769/month — #2,518 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sqlfluff_templater_dbt-4.3.0-py3-none-any.whl
Keywords: sqlfluff, sql, linter, formatter, bigquery, clickhouse, databricks, db2, duckdb, exasol, greenplum, hive, materialize, mysql, postgres, redshift, snowflake, soql, sparksql, sqlite, teradata, tsql, dbt
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
collate-sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 15,000 on PyPI
dbt-extractorExtracts metadata (refs, sources, configs) from…
permissive · top 1,000 on PyPI
sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 5,000 on PyPI
dbt-core-interfaceProvides a lightweight Python interface to…
permissive · top 15,000 on PyPI
shandy-sqlfmtA command-line SQL formatter that automatically…
permissive · top 5,000 on PyPI
sqlfluffrsSQLFluff-rs is a Rust-based optional component…
permissive · top 15,000 on PyPI
sqlglotSQLGlot parses, transpiles, optimizes, and…
permissive · top 1,000 on PyPI
sqlglotrsA SQL parser, transpiler, and optimizer that…
permissive · top 5,000 on PyPI
collate-sqllineageAnalyzes SQL statements to extract source and…
permissive · top 5,000 on PyPI
dbt-osmosisdbt-osmosis is a CLI tool and Python package…
permissive · top 15,000 on PyPI