fastapi-async-sql-profiler
Installation
pip install fastapi-async-sql-profiler
Usage:
- Update the database connection URL in the .env file.
SQL_PROFILER_DATABASE_URL=<database_connection_url>
- Declare the middleware in your main FastAPI file.
from fastapi_async_sql_profiler import SQLProfilerMiddleware
from fastapi_async_sql_profiler import profiler_router
from fastapi_async_sql_profiler import init_db
# don't forget to import the engine that your project uses
from YOUR_PROJECT import engine
# add SQL Profiler [begin]
app.include_router(profiler_router)
task = asyncio.create_task(init_db())
SQL_PROFILER_PASS_ROUTE_STARTSWITH = [
'/docs',
'/openapi.json',
'/favicon.ico',
]
app.add_middleware(
SQLProfilerMiddleware,
engine=engine, # specify the engine that your project uses
skip_route_startswith=SQL_PROFILER_PASS_ROUTE_STARTSWITH,
)
# add SQL Profiler [end]
Endpoints
Please paste the following endpoints in the browser to see the results.
-
/profiler/pages/requests: Displays all captured requests with pagination support. -
/profiler/pages/request/{id}: Detailed information about a specific request identified by its ID. -
/profiler/pages/request/{id}/sql: Queries related to a specific request identified by its ID. -
/profiler/pages/request/{id}/sql/{id}: Details of a specific query identified by its ID.
Contributing
Contributions are welcome! If you find a bug or have suggestions for improvements, please open an issue or submit a pull request.
Release files for fastapi_async_sql_profiler 0.1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_async_sql_profiler-0.1.4.1.tar.gz | 109.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_async_sql_profiler-0.1.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 231.5 kB
Release files / fastapi_async_sql_profiler-0.1.4.1.tar.gz
| Download URL | fastapi_async_sql_profiler-0.1.4.1.tar.gz |
|---|---|
| Size | 109.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
648e32141ea8bbaa9eb0c00dba190349409b7d30c5a97caaffc79ebbab004ae2
|
|
BLAKE2b-256 checksum How to use checksums |
d7154621efe323b967206a67a1438fac6dd52457edc7cbcc47adba7fade67d23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.2 Darwin/24.1.0
|
Release files / fastapi_async_sql_profiler-0.1.4.1-py3-none-any.whl
| Download URL | fastapi_async_sql_profiler-0.1.4.1-py3-none-any.whl |
|---|---|
| Size | 122.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1a356dd4f6d977df489d03cb89d5aeee9135053bddc613728cf208b72f843db
|
|
BLAKE2b-256 checksum How to use checksums |
3a1d2d2dd1956ef123e575774991f76b2922ac142bf629710a8c25fbdebaf514
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.2 Darwin/24.1.0
|