A utility to profile SQL queries made by Django ORM and provide insights into their performance
Project description
Django Query Profiler
Django Query Profiler is a utility that profiles SQL queries made by Django ORM, providing insights into their performance and suggesting optimizations. This package is particularly useful for developers who want to improve the efficiency of their database interactions, focusing on the Django admin interface.
Features
- Automatically profiles SQL queries made in the Django admin section
- Saves query profiles to a database table with execution time and timestamp
- Provides an admin interface for viewing, searching, and analyzing query profiles
Installation
To install Django Query Profiler, simply run:
pip install django-query-profiler
Usage
Update your Django project's settings.py file to include the QueryProfilerMiddleware and register the django_query_profiler app.
Add the middleware to the MIDDLEWARE setting:
MIDDLEWARE = [ ... 'django_query_profiler.middleware.QueryProfilerMiddleware', ... ]
Include 'django_query_profiler' in the INSTALLED_APPS setting:
INSTALLED_APPS = [ ... 'django_query_profiler', ... ]
Run the following commands in your project's root directory to create the necessary QueryProfile table in the database:
python manage.py makemigrations django_query_profiler python manage.py migrate
Once the package is installed and configured, the Django Query Profiler will automatically start profiling SQL queries made in the admin section. Each query will be stored as a QueryProfile record in the database, including the SQL query, execution time, and timestamp.
Access the query profiles in the Django admin interface by navigating to /admin/django_query_profiler/queryprofile/. From there, you can view, search, and analyze the query profiles to identify performance bottlenecks and potential optimizations.
License
This project is licensed under the MIT License. See the LICENSE file for details. Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
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-query-profiler-Georgia-0.1.0.tar.gz
.
File metadata
- Download URL: django-query-profiler-Georgia-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b9a4ba02d246a57eb4a346a9d4dcf6251b8a3bbe7df253f1199f573609ecaeb |
|
MD5 | 6d4c5cf3c6e39c9d96141ea64422a74d |
|
BLAKE2b-256 | 1840dd96dd55ef21aca9465812e1c87d5c0f8d3e10cf1dd9dd3009183e8751ab |
File details
Details for the file django_query_profiler_Georgia-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_query_profiler_Georgia-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62d7eb04cdcaff95832f1efedd18b3363bd7c39f96afe2bea51b51c9869dbfcf |
|
MD5 | 218e97929cfe718bcee0e42cbbb15223 |
|
BLAKE2b-256 | 840f43d74ce526cc604b1c69eb9177347b90843c0962a602ea4a07f3b4158db3 |