FastAPI extension to provide metrics on SQL queries per request.
Project description
fastapi_queryinspect
FastAPI-QueryInspect is a FastAPI extension that provides SQL query metrics and analysis per request, inspired by Flask-QueryInspect (https://github.com/noise/flask-queryinspect) and Django-QueryInspect (https://github.com/dobarkod/django-queryinspect). It tracks query performance, identifies slow queries and duplicate table access, and works with SQLAlchemy to offer detailed timing stats and request-level SQL insights source https://github.com/atv7/fastapi_queryinspect/tree/main
Installation
pip install fastapi-queryinspect
Usage
app = FastAPI()
query_inspect = QueryInspect(app)
Configuration
QueryInspect has the following optional config vars that can be set in Flask's app.config:
| Variable | Default | Description |
|---|---|---|
| QUERYINSPECT_ENABLED | True | False to completely disable QueryInspect |
| QUERYINSPECT_HEADERS | True | Enable response header injection |
| QUERYINSPECT_LOG | True | Enable logging |
| QUERYINSPECT_SLOW_THRESHOLD | 0.5 | Show queries >= 0.5s |
| QUERYINSPECT_DUPLICATE_LIMIT | 5 | Show queries after 5 duplicates |
Log Format
[SQL] %d queries (%d duplicates), %d ms SQL time, %d ms total request time
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_queryinspect-0.1.4.tar.gz.
File metadata
- Download URL: fastapi_queryinspect-0.1.4.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc341ce5453c6b343935352475ecbb894a8b3d48cee2f717c0fb5ee31112e207
|
|
| MD5 |
ffccf01e242bb14c55887e59235352c1
|
|
| BLAKE2b-256 |
73374d084a82d4b396262c0223c513e9534106bef8bc8dd61d1771608a1d174c
|
File details
Details for the file fastapi_queryinspect-0.1.4-py3-none-any.whl.
File metadata
- Download URL: fastapi_queryinspect-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cecf1c97603b4a9831bf464017a765755e7023f47f7a3c1f6b418057d712d17
|
|
| MD5 |
2871fc5305e2379b15c0257165c66144
|
|
| BLAKE2b-256 |
6bb9975f5e169d360165330cc8dce4a851ae4d3902e5d3c73eac3d42c2584a46
|