SQLTy vs Squawk¶
Both lint PostgreSQL migrations for statements that lock tables or rewrite them under load. Squawk is the established migration linter: a Rust CLI, language server and formatter that lints the SQL files you pass it, with over 70 rules. SQLTy lints the new statements of your schema files against a baseline revision, so it knows every existing table and column, and it knows the Python code that has to keep working while the migration runs.
Quick comparison¶
| Squawk 2.74 | SQLTy 0.10 | |
|---|---|---|
| Reads | The SQL files or stdin you pass | New statements in the schema files, against a git revision or snapshot |
| Knows the existing schema | No: only tables created in the same transaction | Yes: every table and column of the baseline |
| Type changes | Flags every ALTER COLUMN ... TYPE |
Only those that rewrite the table, from the column's current type |
| Dropped columns | Flags every drop | Flags a drop only when a query of the other revision still reads it |
| Rules | Over 70, including schema style (prefer-text-field, prefer-bigint-over-int) |
17 migration rules, plus the query and row type rules |
| Transactions | Follows BEGIN and COMMIT; assume_in_transaction for files a tool wraps in one |
Follows BEGIN and COMMIT |
| Suppression | -- squawk-ignore rule |
-- sqlty: ignore[rule] on or above the statement |
| PostgreSQL version | --pg-version |
Not configurable |
| Python code | Not read | Queries checked against both schemas |
| MigrationPilot benchmark, 33 hazards (strict) | 20 (Squawk 2.62), with 1 false positive in 17 safe cases | 28 (33 with query-aware breaking), no false positives |
Where SQLTy is stronger¶
- Context. It knows the old schema, so it skips metadata-only type changes and new tables, and it reports a drop only when code still reads the column.
- Code and migration together.
sqlty breakingchecks old code against the new schema and new code against the old one, the two mixes of a rolling deploy. - Transaction-shape rules, such as multi-table locks, locked backfills and unbatched backfills.
Where Squawk is stronger¶
- Breadth of style rules (
ban-*,prefer-*) that apply to any SQL file. - No setup: it runs on any file, with no baseline revision.
- A PostgreSQL version setting for version-specific advice.
- Maturity: a widely used linter with a GitHub Action and docs for each framework.
Which should you choose?¶
Choose Squawk for a fast, context-free gate on any migration file, or when the code querying the database isn't in the same repository.
Choose SQLTy when migrations live next to the Python code that queries the same tables, and you want one tool to judge the migration and the code that has to keep working through it.
Use both. They don't conflict, and Squawk's style rules complement SQLTy's context-aware lock rules.
What SQLTy is missing¶
- Schema style rules (
prefer-text-field,prefer-timestamptzand others). - A PostgreSQL version setting.
- Fixes: SQLTy's migration rules report the problem but don't rewrite it.
Common questions¶
Does SQLTy need a database to check migrations?¶
No. It replays the migrations at the baseline revision and at your working tree.
Sources¶
- Squawk rules, CLI and
.squawk.tomland Alembic usage, Squawk 2.74.0 - MigrationPilot
bench/corpusat 157bcc5: 56 labelled files. SQLTy was measured on the rule branches released in 0.9.0 (2026-11-20); Squawk 2.62.0's score comes from the benchmark's own table.