Metadata-Version: 2.1
Name: django-sql-profiler
Version: 0.0.12
Summary: Simple SQL Profiler for Django
Author: David (thinhit@yahoo.com)
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown

# 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:**
    ```bash
    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:
    ```python
    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.

