# SQLTy vs sqruff

Both lint SQL in Rust, both have a language server, and SQLTy uses sqruff internally. [sqruff](<https://github.com/quarylabs/sqruff>) is a style linter and formatter for `.sql` files: a SQLFluff port with 27 dialect grammars, 78 rules and Jinja/dbt templating, and no knowledge of your schema. SQLTy is a type checker for SQL inside Python strings (and `.sql` query files): it knows your tables, so it can check column names, types, nullability and parameters. `sqlty format` and the opt-in `sqruff` rule run sqruff's rules on the SQL in your Python strings.

## Quick comparison

|  | sqruff 0.44 | SQLTy 0.10 |
| --- | --- | --- |
| Checks | Style and some correctness (ambiguous references, unused aliases) | Types, nullability, parameters, schema references, migrations |
| Knows your schema | No | Yes: DDL and migrations |
| Where SQL lives | `.sql` files | Python strings, `.sql` named-query files |
| Rules | 78, 55 with fixes | Over 70, one of them `sqruff` (sqruff's core rules, off by default) |
| Dialects | 27 hand-written grammars, including Athena, Databricks, Trino, Teradata | sqlparser-rs dialects; PostgreSQL, MySQL, SQLite tested, others best effort |
| Templating | Jinja, dbt, SQLMesh, placeholders | Not needed: f-strings and branches read as query variants |
| Editor | Diagnostics, whole-file formatting, semantic tokens | Diagnostics, quick fixes, completion, hover, signature help, go to definition, schema-aware semantic tokens |
| Speed per query | About 1.7 ms (4 cores) | About 20 µs type check |
| Editor latency, 100-query file | 355 ms per edit | 28 ms per edit |

## Where SQLTy is stronger

- **It knows your tables.** A misspelled column, a wrong row type or a nullable column read as non-null are invisible to a style linter.
- **SQL in code.** Queries inside Python strings, which sqruff doesn't read.
- **A richer language server**, with quick fixes, completion, hover, signature help and go to definition.
- **Speed.** It's about 80 times faster per query in CI, and 12 times faster per edit in the editor.

## Where sqruff is stronger

- **Style.** Capitalization, aliasing, layout and dozens of conventions with fixes.
- **Dialects and templating:** dbt and Jinja projects, warehouse dialects SQLTy only parses on a best-effort basis.
- **A Zed extension** and a web extension for VS Code. SQLTy has no Zed extension yet.

## Which should you choose?

Choose sqruff for `.sql` files in a dbt or analytics project, where style and dialect coverage matter and there is no application code.

Choose SQLTy for SQL that an application runs, where the question is whether the query matches the schema and the code that reads its rows.

Use both: SQLTy already does. `sqlty format` formats query strings with sqruff's layout rules, and `[tool.sqlty.rules] sqruff = "warn"` reports sqruff's other core rules in Python strings.

## What SQLTy is missing

- Quick fixes for `sqruff` findings: sqruff has fixes for 55 rules, but SQLTy only reports them.
- Incremental `sqruff` linting in the editor: with the rule on, every edit re-lints every query in the file (203 ms on 100 queries, instead of 28 ms).
- A Zed extension.

## Common questions

### Does SQLTy replace sqruff?

No. SQLTy checks meaning against a schema, and sqruff checks style. SQLTy bundles sqruff's rules for SQL inside Python, but sqruff remains the tool for `.sql` style in dbt projects.

## Sources

- [sqruff](<https://github.com/quarylabs/sqruff>) main e431978 (v0.44.0), PyPI sqruff 0.44.0
- Benchmarks: one schema, N copies of a join/group-by query, median of 3 runs on 4 cores, sqlty 0.9.0 (2026-11-28)
