nplusone
Detecting the n+1 queries problem in Python
Decision gist · record as of 2026-08-14
No—not for new projects. The package is abandoned (last release May 2018, no commits since November 2022) and its license treatment is unclear. While it solves a real problem and has low install friction, modern Django and SQLAlchemy versions may not be fully supported, and there is no active maintenance. Consider modern alternatives like django-silk, django-debug-toolbar, or SQLAlchemy's own query analysis tools for current development.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Development-only tool; do not deploy to production.
- Requires Django >= 1.8 or Flask-SQLAlchemy for framework integrations.
- Low install friction with only two runtime dependencies (six and blinker).
License · maintenance · safety
(unclear) — License treatment is unclear; raw license text indicates copyright by Joshua Carp but no SPDX identifier is present. Verify licensing terms before use in proprietary or commercial contexts.
last release 2018-05-21 (3007 days) · last repo commit 2022-11-25 · 1,068 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 600,458 downloads/mo, #5,821 on PyPI
Alternatives
Verify before relying
pip install nplusone
# Django: add to INSTALLED_APPS and MIDDLEWARE
INSTALLED_APPS = (..., 'nplusone.ext.django')
MIDDLEWARE = ('nplusone.ext.django.NPlusOneMiddleware', ...)
# Flask-SQLAlchemy
from nplusone.ext.flask_sqlalchemy import NPlusOne
app = Flask(__name__)
NPlusOne(app)- Whether the unclear license permits commercial or proprietary use
- Compatibility with modern Django and SQLAlchemy versions released after 2018
- Whether the tool functions correctly with current ORM lazy/eager loading patterns
What it is and what it does
nplusone is an ORM profiling tool that detects the n+1 queries problem—a common performance pitfall where an application issues many redundant database queries instead of using efficient joins or batch loading. It integrates with Django, Flask-SQLAlchemy, Peewee, and generic WSGI applications to monitor query patterns during development.
The tool logs warnings when it detects lazy-loaded relationships that could be eagerly loaded for better performance, and also warns about eagerly loaded data that is never accessed in the current request. It supports both framework middleware integration (Django, Flask) and a generic profiler context manager for non-HTTP code. Configuration options allow raising exceptions on detected problems to fail automated tests, and whitelisting specific models or fields to suppress false positives.
Use it for
- Identify n+1 query patterns during Django development before they reach production
- Profile Flask-SQLAlchemy applications to find inefficient relationship loading
- Detect unused eager loads that waste database resources in request handlers
- Enforce query efficiency in automated tests by raising exceptions on n+1 detection
- Diagnose slow ORM performance by pinpointing the exact code lines causing lazy loads
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
No—not for new projects.
The package is abandoned (last release May 2018, no commits since November 2022) and its license treatment is unclear. While it solves a real problem and has low install friction, modern Django and SQLAlchemy versions may not be fully supported, and there is no active maintenance. Consider modern alternatives like django-silk, django-debug-toolbar, or SQLAlchemy's own query analysis tools for current development.
Install
nplusone on PyPI
Before you install
Low install friction with only two runtime dependencies (six and blinker). However, the project is abandoned—last release was in May 2018 and no commits since November 2022. Not suitable for production use; development-only tool.
Development-only tool; do not deploy to production. Requires Django >= 1.8 or Flask-SQLAlchemy for framework integrations.
License in practice
License treatment is unclear; raw license text indicates copyright by Joshua Carp but no SPDX identifier is present. Verify licensing terms before use in proprietary or commercial contexts.
Quickstart
pip install nplusone
# Django: add to INSTALLED_APPS and MIDDLEWARE
INSTALLED_APPS = (..., 'nplusone.ext.django')
MIDDLEWARE = ('nplusone.ext.django.NPlusOneMiddleware', ...)
# Flask-SQLAlchemy
from nplusone.ext.flask_sqlalchemy import NPlusOne
app = Flask(__name__)
NPlusOne(app)
Verify before relying
- Whether the unclear license permits commercial or proprietary use
- Compatibility with modern Django and SQLAlchemy versions released after 2018
- Whether the tool functions correctly with current ORM lazy/eager loading patterns
Package facts
| License | Not declared unclear |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagessixblinker |
| Maintenance | Abandoned 3,007 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 600,458 / month, #5,821 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: nplusone-1.0.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “n+1 query detection”
- nplusoneDetects n+1 query problems in Python ORMs (Django, SQLAlchemy,…
- pysigma-backend-splunkTranslates Sigma detection rules into Splunk search queries,…
- django-zealDetects N+1 query problems in Django applications by monitoring…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also django-zeal · sqlalchemy-mixins · pylint-flask-sqlalchemy · sqltap · peewee · SQLAlchemy · Flask-SQLAlchemy · sqlalchemy-filters · django-pg-returning · ormar