Simple SQL Profiler for Django
Project description
Django SQL Profiler
Project Description: Django SQL Profiler is a lightweight package inspired by the Sentry SDK. It allows you to effortlessly capture all SQL statements generated by your Django application and store them in MongoDB. To use this package, ensure that you have PyMongo installed.
How to Use:
-
Installation:
pip install django-sql-profiler
-
Initialization: Import the
sql_profiler
module and call theinstall_sql_hook
function with the desired configuration options. Example:import sql_profiler sql_profiler.install_sql_hook( { 'slow_queries_threshold': 0.2, 'app_namespace': ['apps.'], 'mongodb': { 'uri': MONGODB, 'db': MONGODB_DB, 'collection': 'sql_slow_queries' } } )
-
Configuration Options:
-
slow_queries_threshold
(float): Set the threshold for slow queries in seconds. -
app_namespace
(list): Specify the namespaces of your Django apps to filter SQL statements. -
mongodb
(dict): Configure MongoDB connection details.uri
(str): MongoDB connection URI.db
(str): MongoDB database name.collection
(str): MongoDB collection to store SQL slow queries.
-
-
Note: Ensure that PyMongo is installed in your environment before using this package.
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
File details
Details for the file django-sql-profiler-0.0.5.tar.gz
.
File metadata
- Download URL: django-sql-profiler-0.0.5.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c6295c15740f6c18c514ead0cde0f52c568c32f9989d6c5d91bf85210d02fe3 |
|
MD5 | 54fb19d979eb375d03f6f424eb34ed14 |
|
BLAKE2b-256 | 1ceab0913b955a268652899e169dc77d0a3804a87c834a5313c12d13c4d8b282 |
Provenance
File details
Details for the file django_sql_profiler-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: django_sql_profiler-0.0.5-py3-none-any.whl
- Upload date:
- Size: 1.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ce37ffbe39d539290ff802d045a21ef11c3652e08e1eb1deceaeb995cac96f8 |
|
MD5 | e2516f98b237311abb55814b55036e9c |
|
BLAKE2b-256 | 6b42ee4d40909ad6f87b65d677de46baf6ef54c411df67b3ed98362973a96e6b |