Skip to main content

A simple Django middleware to log SQL queries during development.

Project description

Django Query Profiler

A simple Django middleware to log SQL queries executed during a request. This middleware is active only when DEBUG = True.

Installation

pip install bear-django-query-profiler

Usage

  1. Add the middleware to your MIDDLEWARE list in settings.py. It should be placed after any other middleware that might generate queries.

    # settings.py
    MIDDLEWARE = [
        # ... other middleware
        'query_profiler.middleware.QueryProfilerMiddleware',
    ]
    
  2. (Optional) You can specify a list of string patterns to ignore in the logs. Any query containing one of these patterns will not be logged.

    # settings.py
    QUERY_PROFILER_IGNORE_PATTERNS = ['global_system_logs', 'django_session']
    
  3. Ensure your logging is configured to display DEBUG level messages.

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

bear_django_query_profiler-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bear_django_query_profiler-0.1.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file bear_django_query_profiler-0.1.0.tar.gz.

File metadata

File hashes

Hashes for bear_django_query_profiler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d1747bd624fca7f1c6067664923c42188d3997afa2a623acee2450c937c22cf2
MD5 0d595335283943b0c7e7b1c268d71fe1
BLAKE2b-256 235feca1a98466feb17e4e2b388ff1d8c358a2ad21eda1be1e55d49feed6983f

See more details on using hashes here.

File details

Details for the file bear_django_query_profiler-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bear_django_query_profiler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee660d92f201d58ce8e3aa979a355edae14cbb7b06abfc3729e5efd1674d642c
MD5 12c06309e0b97dd7a27b30864125f2c5
BLAKE2b-256 aaf44c5516e1197b48c3e3bd409ef95256aa99f2de313d317501d53f11da6d44

See more details on using hashes here.

Supported by

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