--- id: nplusone version: "1.0.0" license: Copyright 2016 Joshua Carp license_treatment: unclear maintenance: abandoned --- # nplusone — Detecting the n+1 queries problem in Python License: unclear · Maintenance: abandoned · Downloads: 600.5K/mo ## 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 above — verify before relying. Detects n+1 query problems in Python ORMs (Django, SQLAlchemy, Peewee) by monitoring lazy and eager loading patterns and logging warnings when inefficient queries are emitted. 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 pip install nplusone uv add nplusone poetry add nplusone ## Installing nplusone 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. 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) Development-only tool; do not deploy to production. Requires Django >= 1.8 or Flask-SQLAlchemy for framework integrations. 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: Copyright 2016 Joshua Carp (unclear) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 600.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags n+1 query detection, ORM performance profiling, lazy loading detector, Django query optimization, SQLAlchemy profiler, database query monitoring, eager load detection, orm-profiling, development-only, abandoned [View on SkillFed](https://skillfed.io/packages/nplusone) · [View on PyPI](https://pypi.org/project/nplusone/)