sqlfmt vs Squawk
sqlfmt
github.comSquawk
squawkhq.comSide by side
| Figure | sqlfmt | Squawk |
|---|---|---|
| Price from | Free | — |
| Free plan | Yes | — |
| Free trial | — | — |
| Open source | — | — |
| Web | Yes | Yes |
| Windows | — | Yes |
| macOS | — | Yes |
| Linux | Yes | Yes |
| iOS | — | Yes |
| Android | — | Yes |
| API | Yes | Yes |
| Self-hosted | Yes | Yes |
| Plans published | 1 | 0 |
| Spec score · SQL Linters and Formatters | 8.5 (#3) | 7.3 (#22) |
| Purpose | sqlfmt is a gofmt-style command-line formatter for PostgreSQL SQL. | It checks schema changes to help prevent blocking reads or writes and breaking existing clients. |
Plans
In their own words
sqlfmt
sqlfmt is a free formatter for PostgreSQL SQL, available as a command-line tool and as a browser formatter running through WebAssembly. Its river-aligned style pads clause keywords so they share a column. The CLI reads SQL from files or stdin and writes formatted SQL to stdout; it can also rewrite files in place, list files needing changes, and show unified diffs. Its explain subcommand formats PostgreSQL plan text and can provide advice, canonicalized output, or structural comparisons. Plan advice describes join order, join and access methods, and parallelism, without costs, row estimates, or timing. The explain diff operation returns exit code 0 for structurally identical plans and 1 when structures differ, so it can be used in scripts and CI. A Go subpackage provides formatting for Go programs, and the project includes Emacs and Vim integrations. The browser build exposes formatting and version functions to JavaScript. Deeply nested subqueries and less common upsert or DDL forms remain best-effort areas. sqlfmt is intended for standalone formatting and SQL used in The Art of PostgreSQL book and courses.
Squawk
Squawk is an open-source linter and language server for PostgreSQL migrations and SQL. It checks schema changes for risks that could prevent database reads or writes. Its rules flag potentially unsafe statements, incompatible changes, and migration patterns, with messages that include examples and reasoning. The command-line tool lints SQL files, and a language server and VS Code extension provide editor linting.
For pull requests, a GitHub Action can lint modified migrations; Squawk can also comment through its upload-to-github command or GitHub App. For CI outside GitHub Actions, the documentation recommends configuring the GitHub App, citing CircleCI as an example. Installation options include npm, PyPI, release binaries, Docker, the browser playground, and VS Code. The playground uses WebAssembly to lint SQL in a browser. Configuration can set the PostgreSQL version, include or exclude rules and paths, and specify whether SQL files are assumed to run in transactions. Some rules are disabled by default and require explicit enabling. Squawk supports PostgreSQL only and has no automatic fixes or custom rules.