local/tools
dev / Python, bundled / v1.0.2

SQL Formatter

Format and lint SQL in any major dialect with sqlfluff, including auto-fix.

Install

  • install
    irm https://raw.githubusercontent.com/chayprabs/localtools/main/sql-formatter/install.ps1 | iex
  • update
    localtools-sql-formatter update
  • remove
    localtools-sql-formatter uninstall

Opens at http://127.0.0.1:47117 in your browser. Run localtools-sql-formatter --help for the command line. Set LOCALTOOLS_NO_OPEN=1 to install without opening it.

Direct download

PlatformFileSize
Windows x64sql-formatter-1.0.2-windows-x64.zip23.0 MB
macOS Apple Siliconsql-formatter-1.0.2-macos-arm64.zip30.2 MB
macOS Intelsql-formatter-1.0.2-macos-x64.zip29.4 MB
Linux x64sql-formatter-1.0.2-linux-x64.zip41.8 MB

SHA-256 checksums are in the release notes; the install scripts verify them for you.

See it

How to use

  1. Paste SQL or drop one or more .sql files.
  2. Pick the dialect (Postgres, MySQL, BigQuery, Snowflake, T-SQL, DuckDB and 22 more); optionally choose rules, a templater (Jinja or placeholders) or upload your .sqlfluff / pyproject.toml.
  3. Press Lint to see every violation with line, column, rule code and a link to the rule docs.
  4. Switch to Fix (or press Fix all) to get the fixed SQL with a diff; copy or download it.
  5. Use Transpile to convert a query between dialects, e.g. T-SQL to Postgres.

FAQ

Are the results the same as the sqlfluff CLI?

Yes. It runs sqlfluff 4 with your dialect and config, and the tests check that lint and fix output equal the sqlfluff CLI on TPC-H, dbt and GitLab SQL.

Can I use my existing .sqlfluff config?

Yes, upload .sqlfluff, setup.cfg, tox.ini or pyproject.toml. It is parsed, never executed: library paths, macro paths and the python/dbt templaters are ignored and listed.

Does it support dbt models?

Use the Jinja templater: it provides dbt's ref, source and config builtins, and fixes are applied to your template source. The full dbt templater (which needs a database connection) is not included.

How big can the SQL be?

The web UI takes up to 512 KB and about 2,000 statements per run, with a 120 second deadline because sqlfluff is thorough but slow. The command line has no limits.

Does my SQL leave my computer?

No. Everything runs locally on 127.0.0.1; there is no network access or telemetry.