Metadata-Version: 2.4
Name: fastapi-nplusone
Version: 0.0.1b2
Summary: A middlewere to help find n+1 queries in sqlalchemy.
License-Expression: BSD-3-Clause
License-File: LICENSE
Classifier: Environment :: Web Environment
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: fastapi
Requires-Dist: sqlalchemy
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# FastAPI / SQLAlchemy N+1 query middleware

A FastAPI middleware to find N+1 queries in development.
This middleware helps developers identify and fix N+1 query issues in their FastAPI applications.
It provides logging information on the query and the number of N+1 query occurrences. This is helpful in identifying and fixing N+1 query issues.

This middleware should probably not be used in production, but it can be useful in development.

## Installation

Pip Install:
```bash
pip install fastapi-nplusone
```

UV install:
```bash
uv install fastapi-nplusone
```

Poetry install:
```bash
poetry add fastapi-nplusone
```

## Usage

You probably want to disable this middleware in production.

```python
from fastapi import FastAPI
from fastapi_nplusone import NPlusOne

app = FastAPI()
if not app.debug:
    app.add_middleware(NPlusOne)

```

### Tests

To run the tests:
```bash
uv run pytest ./tests
```
