Skip to main content

SQLInspector Middleware for Django

Version

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:

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:

    '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

Release files for sql-inspector 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sql-inspector 1.0.1
File Size Uploaded
sql-inspector-1.0.1.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sql-inspector 1.0.1
File Interpreter ABI Platform
sql_inspector-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / sql-inspector-1.0.1.tar.gz

Download URL sql-inspector-1.0.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2366607b45bd1210cd8de197e0988d35a529f20a7219e7075e1a325494bae46e
BLAKE2b-256 checksum
How to use checksums
79181a7a6f8dbd227de27582aa99d0a50673a12b7c6749470e8ea7f8b59d4eda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / sql_inspector-1.0.1-py3-none-any.whl

Download URL sql_inspector-1.0.1-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e22abd06e7f4065a29f9dda0e7a399c1bbceff0f44ce1f953a4879b0e51f094
BLAKE2b-256 checksum
How to use checksums
755a76f76a3874d705a60a851dd0889527bb5604d2f6c6e6e62d2da431109884
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page