sql-inspector


Namesql-inspector JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryA django middleware package to print out queries in the terminal
upload_time2023-10-29 21:09:25
maintainer
docs_urlNone
author
requires_python>=3.11
licenseMIT
keywords
VCS
bugtrack_url
requirements asgiref build certifi cffi charset-normalizer cryptography Django docutils factory-boy Faker idna importlib-metadata iniconfig jaraco.classes jeepney keyring markdown-it-py mdurl more-itertools nh3 packaging pkginfo pluggy pycparser Pygments pyproject_hooks pytest pytest-django python-dateutil readme-renderer requests requests-toolbelt rfc3986 rich SecretStorage six sqlparse twine urllib3 zipp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SQLInspector Middleware for Django

[![Version](https://img.shields.io/badge/version-1.0.1-brightgreen)](https://pypi.org/project/sqlinspector/)

## Description

SQLInspector is a Django middleware that provides developers with insights into the SQL queries generated by Django's ORM. By integrating SQLInspector into your Django project, you can:

- Monitor and capture all SQL queries in real-time.
- Analyze the efficiency and performance of database operations.
- Understand the underlying SQL interactions even when using Django's ORM for database operations.
- Ensure that the application's database interactions are optimized for scalability and performance.

SQLInspector acts as a valuable tool for developers aiming to ensure the optimal performance of their Django applications, especially when dealing with complex database operations and multiple related models.

## Features

- **Monitor and Log SQL Queries:** Every SQL query made by your Django application is recorded.
  
- **Performance Optimization:** Get insights into the most efficient ways of fetching data from your database and optimizing your queries accordingly.
  
- **Diagnostic Aid:** Helps in diagnosing non-performant SQL queries and offers insights into potential optimizations.
  
- **Ease of Integration:** Being a middleware, it seamlessly integrates into any Django project.

## Installation

To install the SQLInspector middleware via pip, use:

```bash
pip install sql-inspector
```

## How to Use

Integrating SQLInspector into your Django project is straightforward. Once you've installed the middleware, the next steps ensure its proper functioning:

### Integration Steps:

1. **Add to MIDDLEWARE in settings.py:**

    After you have installed the SQLInspector via pip, you need to add it to your Django application's `MIDDLEWARE` settings. 

    Open your `settings.py` file and locate the `MIDDLEWARE` section. Add the following line:

    ```python
    'sql-inspector.middleware.querychecker_middleware',
    ```

    Ensure you add it in the appropriate order. For instance, if you have other middleware that processes database queries, you might want to adjust the order to ensure SQLInspector captures the raw queries before any other processing takes place.

2. **Monitor Your Queries:**

    With SQLInspector now integrated, you can monitor, analyze, and optimize your SQL queries in real-time as your application runs.

Remember, SQLInspector doesn't just capture the queries; it provides valuable insights into their performance and efficiency. By understanding the underlying SQL, you can make the necessary adjustments to your Django ORM operations, ensuring optimal database interactions.

Happy optimizing!

## Contributor:

### Aryaman Awasthi

- **GitHub:** [aryaman-awasthi](https://github.com/aryaman-awasthi)
- **LinkedIn:** [Aryaman Awasthi](https://www.linkedin.com/in/aryaman-awasthi/)


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "sql-inspector",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Aryaman Awasthi <aryaman.awasthi79@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/79/18/1a7a6f8dbd227de27582aa99d0a50673a12b7c6749470e8ea7f8b59d4eda/sql-inspector-1.0.1.tar.gz",
    "platform": null,
    "description": "# SQLInspector Middleware for Django\n\n[![Version](https://img.shields.io/badge/version-1.0.1-brightgreen)](https://pypi.org/project/sqlinspector/)\n\n## Description\n\nSQLInspector is a Django middleware that provides developers with insights into the SQL queries generated by Django's ORM. By integrating SQLInspector into your Django project, you can:\n\n- Monitor and capture all SQL queries in real-time.\n- Analyze the efficiency and performance of database operations.\n- Understand the underlying SQL interactions even when using Django's ORM for database operations.\n- Ensure that the application's database interactions are optimized for scalability and performance.\n\nSQLInspector acts as a valuable tool for developers aiming to ensure the optimal performance of their Django applications, especially when dealing with complex database operations and multiple related models.\n\n## Features\n\n- **Monitor and Log SQL Queries:** Every SQL query made by your Django application is recorded.\n  \n- **Performance Optimization:** Get insights into the most efficient ways of fetching data from your database and optimizing your queries accordingly.\n  \n- **Diagnostic Aid:** Helps in diagnosing non-performant SQL queries and offers insights into potential optimizations.\n  \n- **Ease of Integration:** Being a middleware, it seamlessly integrates into any Django project.\n\n## Installation\n\nTo install the SQLInspector middleware via pip, use:\n\n```bash\npip install sql-inspector\n```\n\n## How to Use\n\nIntegrating SQLInspector into your Django project is straightforward. Once you've installed the middleware, the next steps ensure its proper functioning:\n\n### Integration Steps:\n\n1. **Add to MIDDLEWARE in settings.py:**\n\n    After you have installed the SQLInspector via pip, you need to add it to your Django application's `MIDDLEWARE` settings. \n\n    Open your `settings.py` file and locate the `MIDDLEWARE` section. Add the following line:\n\n    ```python\n    'sql-inspector.middleware.querychecker_middleware',\n    ```\n\n    Ensure you add it in the appropriate order. For instance, if you have other middleware that processes database queries, you might want to adjust the order to ensure SQLInspector captures the raw queries before any other processing takes place.\n\n2. **Monitor Your Queries:**\n\n    With SQLInspector now integrated, you can monitor, analyze, and optimize your SQL queries in real-time as your application runs.\n\nRemember, SQLInspector doesn't just capture the queries; it provides valuable insights into their performance and efficiency. By understanding the underlying SQL, you can make the necessary adjustments to your Django ORM operations, ensuring optimal database interactions.\n\nHappy optimizing!\n\n## Contributor:\n\n### Aryaman Awasthi\n\n- **GitHub:** [aryaman-awasthi](https://github.com/aryaman-awasthi)\n- **LinkedIn:** [Aryaman Awasthi](https://www.linkedin.com/in/aryaman-awasthi/)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A django middleware package to print out queries in the terminal",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/aryaman-awasthi/SQLInspector"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "755a76f76a3874d705a60a851dd0889527bb5604d2f6c6e6e62d2da431109884",
                "md5": "a9b97aad395ec9a02af4ff972e2da738",
                "sha256": "9e22abd06e7f4065a29f9dda0e7a399c1bbceff0f44ce1f953a4879b0e51f094"
            },
            "downloads": -1,
            "filename": "sql_inspector-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a9b97aad395ec9a02af4ff972e2da738",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 4013,
            "upload_time": "2023-10-29T21:09:24",
            "upload_time_iso_8601": "2023-10-29T21:09:24.166563Z",
            "url": "https://files.pythonhosted.org/packages/75/5a/76f76a3874d705a60a851dd0889527bb5604d2f6c6e6e62d2da431109884/sql_inspector-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79181a7a6f8dbd227de27582aa99d0a50673a12b7c6749470e8ea7f8b59d4eda",
                "md5": "7649a214456857095b6693337885b6f4",
                "sha256": "2366607b45bd1210cd8de197e0988d35a529f20a7219e7075e1a325494bae46e"
            },
            "downloads": -1,
            "filename": "sql-inspector-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7649a214456857095b6693337885b6f4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 3961,
            "upload_time": "2023-10-29T21:09:25",
            "upload_time_iso_8601": "2023-10-29T21:09:25.583355Z",
            "url": "https://files.pythonhosted.org/packages/79/18/1a7a6f8dbd227de27582aa99d0a50673a12b7c6749470e8ea7f8b59d4eda/sql-inspector-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-29 21:09:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aryaman-awasthi",
    "github_project": "SQLInspector",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "asgiref",
            "specs": [
                [
                    "==",
                    "3.7.2"
                ]
            ]
        },
        {
            "name": "build",
            "specs": [
                [
                    "==",
                    "1.0.3"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2023.7.22"
                ]
            ]
        },
        {
            "name": "cffi",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.3.1"
                ]
            ]
        },
        {
            "name": "cryptography",
            "specs": [
                [
                    "==",
                    "41.0.5"
                ]
            ]
        },
        {
            "name": "Django",
            "specs": [
                [
                    "==",
                    "4.2.6"
                ]
            ]
        },
        {
            "name": "docutils",
            "specs": [
                [
                    "==",
                    "0.20.1"
                ]
            ]
        },
        {
            "name": "factory-boy",
            "specs": [
                [
                    "==",
                    "3.3.0"
                ]
            ]
        },
        {
            "name": "Faker",
            "specs": [
                [
                    "==",
                    "19.12.0"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.4"
                ]
            ]
        },
        {
            "name": "importlib-metadata",
            "specs": [
                [
                    "==",
                    "6.8.0"
                ]
            ]
        },
        {
            "name": "iniconfig",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "jaraco.classes",
            "specs": [
                [
                    "==",
                    "3.3.0"
                ]
            ]
        },
        {
            "name": "jeepney",
            "specs": [
                [
                    "==",
                    "0.8.0"
                ]
            ]
        },
        {
            "name": "keyring",
            "specs": [
                [
                    "==",
                    "24.2.0"
                ]
            ]
        },
        {
            "name": "markdown-it-py",
            "specs": [
                [
                    "==",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "mdurl",
            "specs": [
                [
                    "==",
                    "0.1.2"
                ]
            ]
        },
        {
            "name": "more-itertools",
            "specs": [
                [
                    "==",
                    "10.1.0"
                ]
            ]
        },
        {
            "name": "nh3",
            "specs": [
                [
                    "==",
                    "0.2.14"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "23.2"
                ]
            ]
        },
        {
            "name": "pkginfo",
            "specs": [
                [
                    "==",
                    "1.9.6"
                ]
            ]
        },
        {
            "name": "pluggy",
            "specs": [
                [
                    "==",
                    "1.3.0"
                ]
            ]
        },
        {
            "name": "pycparser",
            "specs": [
                [
                    "==",
                    "2.21"
                ]
            ]
        },
        {
            "name": "Pygments",
            "specs": [
                [
                    "==",
                    "2.16.1"
                ]
            ]
        },
        {
            "name": "pyproject_hooks",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "7.4.3"
                ]
            ]
        },
        {
            "name": "pytest-django",
            "specs": [
                [
                    "==",
                    "4.5.2"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.8.2"
                ]
            ]
        },
        {
            "name": "readme-renderer",
            "specs": [
                [
                    "==",
                    "42.0"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.31.0"
                ]
            ]
        },
        {
            "name": "requests-toolbelt",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "rfc3986",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "rich",
            "specs": [
                [
                    "==",
                    "13.6.0"
                ]
            ]
        },
        {
            "name": "SecretStorage",
            "specs": [
                [
                    "==",
                    "3.3.3"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "sqlparse",
            "specs": [
                [
                    "==",
                    "0.4.4"
                ]
            ]
        },
        {
            "name": "twine",
            "specs": [
                [
                    "==",
                    "4.0.2"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.0.7"
                ]
            ]
        },
        {
            "name": "zipp",
            "specs": [
                [
                    "==",
                    "3.17.0"
                ]
            ]
        }
    ],
    "lcname": "sql-inspector"
}
        
Elapsed time: 0.34267s