--- id: django-queryinspect version: "1.1.0" license: MIT license_treatment: permissive maintenance: abandoned --- # django-queryinspect — Django Query Inspector License: permissive · Maintenance: abandoned · Downloads: 73.6K/mo ## What it is and what it does Django Query Inspector is middleware that intercepts and analyzes SQL queries executed during each web request. It logs aggregate statistics—total query count, execution time, and duplicate detection—and optionally adds these metrics to HTTP response headers for easier debugging without server log inspection. The package detects duplicate queries by normalizing SQL statements to ignore integer values, targeting the common Django pattern where N+1 queries occur due to missing prefetch_related or select_related calls. It can also include Python tracebacks showing where each duplicate query originated, helping developers identify the source code responsible. Configuration options allow fine-tuning of what gets logged, thresholds for query time alerts, and filtering of tracebacks to project-specific paths. Use it for: - Identify N+1 query problems during development by spotting repeated SQL patterns in request logs. - Monitor query performance during testing to catch regressions in SQL execution time across requests. - Debug slow requests by examining query counts and timing in response headers without parsing server logs. - Locate inefficient serialization or view logic by correlating duplicate query tracebacks to application code. - Profile Django views in development to understand SQL behavior before optimization. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Django middleware that logs and reports SQL query statistics for each web request, including query counts, execution time, and detection of duplicate queries. No. The package is abandoned (last commit 2020-02-27, no releases since 2019-09-10) and will not receive security updates or Django compatibility fixes. For modern Django projects, consider actively maintained alternatives like django-debug-toolbar or django-silk, which offer similar query inspection with ongoing support. ## Install pip install django-queryinspect uv add django-queryinspect poetry add django-queryinspect ## Installing django-queryinspect Before you install: Low install friction with a single runtime dependency on Django. However, the package is abandoned—last release was 2019-09-10 and last commit 2020-02-27. No active maintenance means security issues or Django compatibility problems will not be addressed. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and proprietary projects. Quickstart: pip install django-queryinspect # In Django settings.py: MIDDLEWARE += ('qinspect.middleware.QueryInspectMiddleware',) QUERY_INSPECT_ENABLED = True DEBUG = True # Configure logging to see output LOGGING = { 'loggers': { 'qinspect': {'handlers': ['console'], 'level': 'DEBUG'}, }, } Requires Django 1.11 or later and DEBUG = True enabled; SQL query logging does not work without DEBUG mode. Verify before relying: - Compatibility with modern Django versions (3.2+, 4.x, 5.x) given the package's abandonment since 2020. - Whether the heuristic for detecting duplicate queries (ignoring integer values) remains effective with current Django ORM patterns. - Performance impact on high-traffic applications when query logging and traceback collection are enabled. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 73.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags django sql query logging, query performance debugging, duplicate query detection, django middleware sql stats, request sql profiling, django query inspector, sql execution time tracking, django-debugging, query-profiling, abandoned [View on SkillFed](https://skillfed.io/packages/django-queryinspect) · [View on PyPI](https://pypi.org/project/django-queryinspect/)