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:

    import sql_profiler
    
    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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

django_sql_profiler-0.0.7-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_sql_profiler-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 07f7c96d1868bf7e1d71820a6793793ed52375a2bcb72c02a25685771b425181
MD5 c0386ef8195cb92d3289cfbaa0d990ca
BLAKE2b-256 431071bd548b8e539f4aeb2455b2e9b86ecc2dae70fc6e5031350054713d5267

See more details on using hashes here.

Provenance

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