Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsMay 17, 2026·2 min de lectura

SQLFluff — Modular SQL Linter and Auto-Formatter

A configurable SQL linter and formatter supporting over 20 SQL dialects, designed to enforce style rules and catch errors in data pipelines.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
SQLFluff Overview
Comando CLI universal
npx tokrepo install ae7d585b-51a7-11f1-9bc6-00163e2b0d79

Introduction

SQLFluff is an open-source SQL linter that brings the same code-quality discipline to SQL that ESLint brings to JavaScript. It parses, analyzes, and auto-fixes SQL files across many dialects, helping data teams enforce consistent formatting in version-controlled analytics repos.

What SQLFluff Does

  • Lints SQL files against configurable rules for style and correctness
  • Auto-fixes violations with a single command
  • Supports 20+ dialects including PostgreSQL, BigQuery, Snowflake, Redshift, and SparkSQL
  • Integrates with CI pipelines, pre-commit hooks, and dbt projects
  • Provides a templating layer to handle Jinja and dbt macros

Architecture Overview

SQLFluff parses SQL into an abstract syntax tree using dialect-specific grammars. Each rule inspects tree nodes and emits lint violations with optional fix patches. The fix engine applies non-conflicting patches in a single pass; conflicting fixes require multiple passes. A plugin system allows third-party rules.

Self-Hosting & Configuration

  • Install via pip: pip install sqlfluff
  • Configure with .sqlfluff file in your project root
  • Set dialect: [sqlfluff] dialect = bigquery
  • Exclude rules: [sqlfluff:rules] exclude_rules = L011,L031
  • Integrate with pre-commit by adding the sqlfluff hook entry

Key Features

  • Over 60 built-in lint rules covering indentation, aliasing, joins, and naming
  • Dialect-aware parsing handles syntax differences correctly
  • Jinja and dbt templating support for analytics SQL
  • Configurable via TOML or INI-style config files
  • Plugin architecture for custom rules

Comparison with Similar Tools

  • sqlfmt — opinionated formatter with fewer configuration options
  • pg_format — PostgreSQL-only, no lint rules
  • sql-formatter — JavaScript library focused on pretty-printing, no linting
  • dbt SQLFluff plugin — extends SQLFluff with dbt-aware templating
  • SonarQube SQL — enterprise tool with broader scope but commercial licensing

FAQ

Q: Does SQLFluff work with dbt projects? A: Yes. It has built-in dbt templating support and can parse Jinja macros before linting.

Q: Can I use SQLFluff in CI? A: Yes. Run sqlfluff lint --format github-annotation for inline PR comments in GitHub Actions.

Q: How do I ignore a specific violation? A: Add -- noqa: L042 as an inline comment on the offending line.

Q: Does it support BigQuery and Snowflake? A: Yes, both are first-class supported dialects with dedicated grammar files.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados