django_pg_stat_statements
A PostgreSQL query profiler for Django that uses pg_stat_statements extension.
Changelog
v0.1.0
- Forked from django-pg-trunk
Requirements
- Python >= 3.7
- PostgreSQL >= 9.2
- Django >= 2.2
Installation
Install using pip:
pip install django-pg-stat-statements
Then add django_pg_stat_statements to your INSTALLED_APPS.
INSTALLED_APPS = [
...
'django_pg_stat_statements',
]
django-pg-stat-statements will automatically install pg_stat_statements extension for PostgreSQL if it doesn't exist, however pg_stat_statements should be added to shared_preload_libraries in the PostgreSQL config.
Usage
After installing the package, database queries can be examined under PostgreSQL Stat Statements > Query Statistics in Django admin.
Change view have more detailed statistics. All of the columns of pg_stat_statements can be found here.
A possible usecase of QueryStatistic model can be running a cron job that checks if there is a query that takes more time than a specific thershold, and send related alerts (emails, Slack notifications, etc.).
Contribution
As a first step, please open an issue about the feature/bug.
-
Build and run tests with docker-compose:
docker-compose build test_app && docker-compose run --rm test_app
-
Tests can be run using
pytestcommand. Tests for different environments will be run on CircleCI. -
Changes on Django Admin can be tested using
python manage.py runserver 0:8000in development Docker container and navigating to http://127.0.0.1/admin.
Metadata
Release files for django-pg-stat-statements 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_pg_stat_statements-0.1.0.tar.gz | 11.1 kB | Without provenance | Details for django_pg_stat_statements-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_pg_stat_statements-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for django_pg_stat_statements-0.1.0-py3-none-any.whl |
Total release size: 23.8 kB
Release files / django_pg_stat_statements-0.1.0.tar.gz
| Download URL | django_pg_stat_statements-0.1.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab6c3123b21d4b07548c80ab12f6b7c103b24db0f5e07b1cf6a60713d7482f99
|
|
BLAKE2b-256 checksum How to use checksums |
a00e0c8003bb4feb5dcb2e8a4a21215fe3e816d0548be00a4ef27563170ba4d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / django_pg_stat_statements-0.1.0-py3-none-any.whl
| Download URL | django_pg_stat_statements-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
723015da8433faa524478330922bc831dc4abcb5d1878c6dbed8f8405b5dec27
|
|
BLAKE2b-256 checksum How to use checksums |
33ce8c43f98fcf44550deb9178ae03bf877c174ac5298512ffe1616105f487f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for django-pg-stat-statements 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.