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 Distribution

django-sql-profiler-0.0.4.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

django_sql_profiler-0.0.4-py3-none-any.whl (1.9 kB view details)

Uploaded Python 3

File details

Details for the file django-sql-profiler-0.0.4.tar.gz.

File metadata

  • Download URL: django-sql-profiler-0.0.4.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for django-sql-profiler-0.0.4.tar.gz
Algorithm Hash digest
SHA256 fd50146a563db2075b1c32e8524b474f0f52e469afb73c51f7334f06922c67f3
MD5 aee065184a4a03644bd1be79a2629d4b
BLAKE2b-256 c198ff57879f93e65862d1b6ef84798f9ce5111475fe9cdbc20155fb9d0dc9f2

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for django_sql_profiler-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cc798a6da7322d253e072a78d091ba688c98df6b772c45590b29a9e84dab01aa
MD5 7b005955105de54a36046cf327b2dd93
BLAKE2b-256 dd0e1ef15a4e7a4c2d526c447539d2730a1c53cca42af4424084be4ecbd81c3a

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