squawk-cli
Linter for PostgreSQL migrations
What it is and what it does
Squawk is a linter that parses PostgreSQL SQL and migration files to identify patterns that commonly cause production issues: unsafe index creation, lock-prone constraint additions, serial-type pitfalls, and schema changes that block reads or writes. It runs as a CLI tool and outputs warnings with inline suggestions and remediation examples.
The tool supports multiple reporting formats (TTY, JSON, GitLab, GCC), rule exclusion via CLI flags or `.squawk.toml` config files, and inline SQL comments to suppress specific checks. It integrates with pre-commit hooks, GitHub Actions, and VSCode, making it suitable for catching migration problems before they reach production.
Use it for:
- Review migration files in CI/CD to catch blocking operations (e.g., UNIQUE constraints, index creation) before deployment.
- Enforce team standards on column types (e.g., prefer bigint over serial, text over varchar with length limits).
- Suppress known-safe violations per-file or per-rule via comments or config, reducing noise in large legacy codebases.
- Local pre-commit hook to validate SQL syntax and schema safety before pushing to version control.
- Generate structured JSON reports for custom tooling or dashboards that track migration risk over time.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Linter that analyzes PostgreSQL migrations and SQL statements to detect patterns that risk downtime, lock contention, or schema problems, and suggests corrections.
Yes. Squawk is actively maintained, has no known vulnerabilities, and fills a specific niche—preventing downtime from unsafe Postgres migrations. The permissive dual license and multi-platform binaries lower adoption friction. Install if your team runs Postgres migrations and wants automated guardrails; skip if you do not use Postgres or migrations are rare.
Install
squawk-cli on PyPI
pip
pip install squawk-cliuv
uv add squawk-clipoetry
poetry add squawk-cliInstalling squawk-cli
Before you install
Medium install friction due to compiled Rust binaries, but pre-built wheels exist for common platforms (macOS x86_64/arm64, Linux x86_64/aarch64, Windows). Last release 8 days ago; active maintenance with 1153 GitHub stars.
License in practice
Dual-licensed under Apache-2.0 OR MIT (permissive). You may choose either license; no restrictions on commercial or private use.
Quickstart
pip install squawk-cli
squawk example.sql
# or check stdin: squawk --stdin-filepath=migration.sql < migration.sql
Requires Python >=3.8. Pre-built binaries available for macOS (Intel/ARM), Linux (x86_64/aarch64), and Windows; source builds require Rust.
Verify before relying
- How many built-in rules are available and what is their coverage of common migration anti-patterns.
- Performance on large SQL files or migration batches.
- Integration maturity with CI/CD systems beyond GitHub Actions.
Package facts
| License | Apache-2.0 OR MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 8 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 520,481/month — #6,210 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: squawk_cli-2.62.0-py3-none-macosx_10_12_x86_64.whl; squawk_cli-2.62.0-py3-none-macosx_11_0_arm64.whl; squawk_cli-2.62.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; squawk_cli-2.62.0-py3-none-manylinux_2_28_x86_64.whl; squawk_cli-2.62.0-py3-none-win32.whl; squawk_cli-2.62.0-py3-none-win_amd64.whl
Keywords: postgres, postgresql, linter
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
django-pg-zero-downtime-migrationsProvides a Django database backend for…
permissive · top 15,000 on PyPI
migramigra compares PostgreSQL database schemas and…
permissive · top 15,000 on PyPI
pgsanityPgSanity validates PostgreSQL SQL syntax by…
permissive · top 15,000 on PyPI
django-pg-migration-toolsProvides safer, production-ready Django…
permissive · top 15,000 on PyPI
django-migration-linterAnalyzes Django migrations to detect…
permissive · top 5,000 on PyPI
django-pgmigratePrevents migration downtime by detecting and…
permissive · top 5,000 on PyPI
collate-sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 15,000 on PyPI
sqlfluffSQLFluff is a SQL linter and auto-fixer that…
permissive · top 5,000 on PyPI
sqlfluffrsSQLFluff-rs is a Rust-based optional component…
permissive · top 15,000 on PyPI
pglastParses PostgreSQL SQL statements into an…
copyleft · top 5,000 on PyPI