Tooling that feels native to SQLAlchemy. Small, sharply-scoped libraries for the parts of the SQLAlchemy ecosystem that modern tooling forgot — held to 100% branch coverage, a cognitive-complexity gate, and a supply-chain audit scoped to what you actually install.
| Package | What it does | |
|---|---|---|
queryspy |
N+1 and query-budget detection for SQLAlchemy 2.0, sync and async — lazy-load attribution down to the line of your code, a fix: suggestion you can paste, and a pytest gate (--queryspy-strict) |
readme · pypi |
More is planned. Nothing is announced until it ships.
Django developers get assertNumQueries, nplusone, and the Debug Toolbar.
SQLAlchemy developers get told to write their own event listener. The tools that
did exist have aged out: nplusone last shipped in 2018 and predates SQLAlchemy
2.0 entirely, sqltap in 2019. Meanwhile FastAPI plus async SQLAlchemy became
the default modern Python backend, with effectively no tooling of its own.
- Public API only. No monkeypatching of SQLAlchemy internals — that is precisely why the previous generation of these tools stopped working instead of being ported.
- A false positive is worse than a missed detection. A tool that flags correct code gets uninstalled the same day. False-positive suites are release gates here, weighted equally with detection.
- Measure, don't assume. Behaviour claims in these repos are backed by scripts that were actually run against a real session, not by reading docs.
- Minimal dependencies. Every package declares the smallest runtime closure it can defend, and the release gate audits that closure rather than the dev tree.
Issues and discussions welcome in each repo. Not affiliated with the SQLAlchemy project.