--- id: shandy-sqlfmt version: "0.32.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # shandy-sqlfmt — sqlfmt formats your dbt SQL files so you don't have to. License: permissive · Maintenance: active · Downloads: 1.4M/mo ## What it is and what it does This package is a fast, opinionated SQL formatter built for dbt projects and other SQL codebases. It works by lexing SQL into tokens and reformatting to a single enforced style, without requiring a full SQL parser. This approach makes it much faster than traditional linters and easier to maintain. The tool formats select, delete, grant, revoke, and create function statements, preserves comments and some whitespace, and works with Jinja templates embedded in SQL. It integrates with dbt, pre-commit, VSCode, and CI systems. Configuration is minimal—line length and dialect choice (polyglot by default, with special handling for ClickHouse). The package depends on click, jinja2, platformdirs, tomli, and tqdm for CLI, templating, configuration, and progress display. Use it for: - Enforce consistent SQL style across a dbt project without manual code review discussions - Format SQL files automatically in pre-commit hooks or CI/CD pipelines before deployment - Quickly reformat legacy or inconsistently-styled SQL codebases to a standard format - Format Jinja-templated SQL files while preserving template logic - Check SQL formatting compliance in CI without modifying files using --check mode ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A command-line SQL formatter that automatically reformats SQL files to a consistent style, similar to Black for Python or gofmt for Go. Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and fills a clear need for SQL formatting in dbt and analytics workflows. The Apache-2.0 license poses no restrictions. Start with a version-controlled repository and use --check or --diff on first run to verify output before committing changes. ## Install pip install shandy-sqlfmt uv add shandy-sqlfmt poetry add shandy-sqlfmt ## Installing shandy-sqlfmt Before you install: Low install friction with a pure Python wheel and five lightweight runtime dependencies. Actively maintained with a release 4 days ago and steady repository activity. License in practice: Licensed under Apache-2.0 (permissive), allowing use in commercial and private projects with minimal restrictions. Quickstart: pip install "shandy-sqlfmt[jinjafmt]" # Format SQL files in current directory sqlfmt . # Check formatting without modifying files sqlfmt --check . # Format from stdin echo "select 1" | sqlfmt - Requires Python 3.10 or above. The PyPI package name is shandy-sqlfmt, not sqlfmt. Verify before relying: - Whether formatted output is always syntactically valid or if edge cases can break SQL - Performance characteristics when formatting very large files or projects - Completeness of support for SQL dialects beyond the documented ClickHouse special case ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags sql formatter, dbt sql formatting, auto-format sql code, sql code style, jinja sql formatting, sql beautifier, sql formatting tool, sql-formatting, dbt-tools, code-style [View on SkillFed](https://skillfed.io/packages/shandy-sqlfmt) · [View on PyPI](https://pypi.org/project/shandy-sqlfmt/)