fastapi async sqlalchemy profiler
Project description
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.
Project details
Release history Release notifications | RSS feed
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_async_sql_profiler-0.1.4.0.tar.gz.
File metadata
- Download URL: fastapi_async_sql_profiler-0.1.4.0.tar.gz
- Upload date:
- Size: 108.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.2 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
953c2517edf87e1355b2f0b4de28df48c834bb87e11e4e1654dda79ac382014a
|
|
| MD5 |
7cbe8f888cd4df6e9224a6bda018885c
|
|
| BLAKE2b-256 |
17cb99719b7afa7bf7fae59390ea1b94d59fa441c5252e6edc3f49251d004a55
|
File details
Details for the file fastapi_async_sql_profiler-0.1.4.0-py3-none-any.whl.
File metadata
- Download URL: fastapi_async_sql_profiler-0.1.4.0-py3-none-any.whl
- Upload date:
- Size: 122.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.2 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
867b897613c128919fbb7e73de0b0b1ea13ccce1d188b2a69f5b1d909df14ca8
|
|
| MD5 |
0d4026f0b6743e4ff4cd96d554c9af88
|
|
| BLAKE2b-256 |
8c3fab254160fbecac4f4d580cadf45e3f6022ef93684f6586e76dcaacf4d559
|