Skip to main content

Simple SQL Profiler for Django

Project description

Django SQL Profiler

Project Description: Django SQL Profiler is a lightweight package inspired by the Sentry SDK. It allows you to effortlessly capture all SQL statements generated by your Django application and store them in MongoDB. To use this package, ensure that you have PyMongo installed.

How to Use:

  1. Installation:

    pip install django-sql-profiler
    
  2. Initialization: Import the sql_profiler module and call the install_sql_hook function with the desired configuration options. Example:

    from django_sql_profiler import install_sql_hook
    
    sql_profiler.install_sql_hook(
        {
            'slow_queries_threshold': 0.2,
            'app_namespace': ['apps.'],
            'mongodb': {
                'uri': MONGODB,
                'db': MONGODB_DB,
                'collection': 'sql_slow_queries'
            }
        }
    )
    
  3. Configuration Options:

    • slow_queries_threshold (float): Set the threshold for slow queries in seconds.

    • app_namespace (list): Specify the namespaces of your Django apps to filter SQL statements.

    • mongodb (dict): Configure MongoDB connection details.

      • uri (str): MongoDB connection URI.
      • db (str): MongoDB database name.
      • collection (str): MongoDB collection to store SQL slow queries.
  4. Note: Ensure that PyMongo is installed in your environment before using this package.

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_sql_profiler-0.0.14.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

django_sql_profiler-0.0.14-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file django_sql_profiler-0.0.14.tar.gz.

File metadata

  • Download URL: django_sql_profiler-0.0.14.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for django_sql_profiler-0.0.14.tar.gz
Algorithm Hash digest
SHA256 08cae14d903b6867371f528d01051f3d37c9d636de612bd89e87b11d97537020
MD5 27981753a721dbaa122c699667b46ef5
BLAKE2b-256 ebaf5c161b4efd000fa41d3577b9101ee3971584e7022f29e2e61c639dbaedd1

See more details on using hashes here.

File details

Details for the file django_sql_profiler-0.0.14-py3-none-any.whl.

File metadata

File hashes

Hashes for django_sql_profiler-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 50280851a3f8f060450a0bf0cec0802951b02d48e91d092d4ff54b3e7e8e85d4
MD5 817c0f38514214002eee2d68c247b5be
BLAKE2b-256 6f13e8a40b540c2184c28669c75d919cc59da3ed88c64631040eb448eb8d5a7c

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