Skip to main content

Middleware that pretty prints Django’s sql statements.

https://raw.githubusercontent.com/thebjorn/django-sqlprint-middleware/master/docs/_static/sample-output.png

Installation

Install from PyPI:

pip install django-sqlprint-middleware

then add it to the MIDDLEWARE settings in your settings.py file:

MIDDLEWARE = (
    ...
    'django_sqlprint_middleware.SqlPrintMiddleware',
    ...
)

(Use MIDDLEWARE_CLASSES in older Djangos.)

This middleware is not order sensitive so you can put it at any position in the list of classes.

Settings

The following settings control the behavior (all of these have defaults).

DEBUG or TESTING

Either of these need to be True for the middleware to run.

SQLPRINT_MIDDLEWARE

Set to False to skip middleware without removing it.

X_DB_HITS

Set to false to prevent db hits being sent in the response header ‘X-DB-hits’

SQLPRINT_MAX_QUERIES

Raise an exception if the number of queries for a view is greater than this. Default is 1200 (zero means no check).

SQLPRINT_MIN_QUERIES

For less output you can set this to the number of queries a view can make before queries are printed (default is zero).

Metadata

Release files for django-sqlprint-middleware 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-sqlprint-middleware 0.1.4
File Size Uploaded
django-sqlprint-middleware-0.1.4.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-sqlprint-middleware 0.1.4
File Interpreter ABI Platform
django_sqlprint_middleware-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / django-sqlprint-middleware-0.1.4.tar.gz

Download URL django-sqlprint-middleware-0.1.4.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fb285a10cf865b72cc255c9119b894b6263a3d483fdb9f34b185d64fb5798c34
BLAKE2b-256 checksum
How to use checksums
61872a1ada4c4223468641fedb142b386f249da19eb5d6d8044c9c3811671ea0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.3 CPython/3.6.8

Release files / django_sqlprint_middleware-0.1.4-py3-none-any.whl

Download URL django_sqlprint_middleware-0.1.4-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b162dc05a6c602fdc016aa47c78999f3c5090217ea2161012cebea962fbf50de
BLAKE2b-256 checksum
How to use checksums
7f3575c2f861822edb25642809bd7dea618ce4a34a2e1b8cbe13be7bbe7cc069
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.3 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page