Skip to main content

Django SQL Middleware

A simple middleware aimed to capture all queries in a request and provide basic SQL profiling such as execution time, execution plan, and query traceback.

This package is only intended to run in development mode for non-sqlite database.

Currently, this package only tested in projects that uses psycopg2 (postgres) as default database engine.

How To Install

  1. Get the package from pypi: pip install django-sql-middleware

  2. In settings.py add:

    INSTALLED_APPS = [
        # your other apps
        "sqlmiddleware"
    ]
    
    MIDDLEWARE = [
        # your other middlewares
    ]
    
    if DEBUG:
        MIDDLEWARE.append("sqlmiddleware.middlewares.LogSQLMiddleware")
    
  3. Register urls in your_project/urls.py:

    from django.urls import include, path
    
    urlpatterns = [
        # other urls,
        path("__sql/", include("sqlmiddleware.urls")),
    ]
    
  4. Run collectstatic to serve included css and js assets: ./manage.py collectstatic

  5. Start the development server: ./manage.py runserver

  6. you should be able to access localhost:8000/__sql in your browser.

Metadata

Release files for django-sql-middleware 0.0.6

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-sql-middleware 0.0.6
File Size Uploaded
django-sql-middleware-0.0.6.tar.gz 106.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-sql-middleware 0.0.6
File Interpreter ABI Platform
django_sql_middleware-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 217.9 kB

Release files / django-sql-middleware-0.0.6.tar.gz

Download URL django-sql-middleware-0.0.6.tar.gz
Size 106.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8ea59fceeab494887d5f686892ee710f66d4efb4dafb46b7b128e108412a70ae
BLAKE2b-256 checksum
How to use checksums
06660e6297c09f958565392d1d30b592d91ef951ed66ed8dadc8238c2700f2fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

Release files / django_sql_middleware-0.0.6-py3-none-any.whl

Download URL django_sql_middleware-0.0.6-py3-none-any.whl
Size 111.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c08dd84c06542d9a56fbe98b02eacd02b67134d0df54f906a05a36089bbc2d42
BLAKE2b-256 checksum
How to use checksums
1a99e53f8dce4a6f809a42c638aa387ae451b093432afd9bc1fb81498eddebc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

Release history Release notifications | RSS feed

0.0.7

2 release files

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

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