Skip to main content

Pretty print Django's SQL statments

Project description

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).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-sqlprint-middleware-0.1.4.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-sqlprint-middleware-0.1.4.tar.gz.

File metadata

  • Download URL: django-sqlprint-middleware-0.1.4.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django-sqlprint-middleware-0.1.4.tar.gz
Algorithm Hash digest
SHA256 fb285a10cf865b72cc255c9119b894b6263a3d483fdb9f34b185d64fb5798c34
MD5 f1f51a2710039467426031579308801e
BLAKE2b-256 61872a1ada4c4223468641fedb142b386f249da19eb5d6d8044c9c3811671ea0

See more details on using hashes here.

File details

Details for the file django_sqlprint_middleware-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: django_sqlprint_middleware-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for django_sqlprint_middleware-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b162dc05a6c602fdc016aa47c78999f3c5090217ea2161012cebea962fbf50de
MD5 6a4b06c9dd9fd86581499782a546bd4d
BLAKE2b-256 7f3575c2f861822edb25642809bd7dea618ce4a34a2e1b8cbe13be7bbe7cc069

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page