{"id":23593,"library":"django-queryinspect","title":"django-queryinspect","description":"Django Query Inspector is a middleware that logs or displays SQL queries executed during a request, including duplicate queries and query counts. Current version 1.1.0, last updated in 2019. No active development, stable for Django 2.x and earlier.","status":"maintenance","version":"1.1.0","language":"python","source_language":"en","source_url":"https://github.com/dobarkod/django-queryinspect","tags":["django","sql","inspect","queries","debug"],"install":[{"cmd":"pip install django-queryinspect","lang":"bash","label":"default"}],"dependencies":[],"imports":[{"note":"Old package name was django-queryinspect, but module is queryinspect","wrong":"from django_queryinspect import QueryInspectMiddleware","symbol":"QueryInspectMiddleware","correct":"from queryinspect.middleware import QueryInspectMiddleware"}],"quickstart":{"code":"MIDDLEWARE = [\n    'queryinspect.middleware.QueryInspectMiddleware',\n    # ... other middleware\n]\n\n# Optional settings\nQUERYINSPECT_LOG_TRACEBACKS = False\nQUERYINSPECT_ABSOLUTE_LIMIT = 100  # in ms\nQUERYINSPECT_LOG_QUERIES = True\nQUERYINSPECT_LOG_DUPLICATE_QUERIES = True","lang":"python","description":"Add the middleware to your Django settings. Visit any page and check the console or Django server output for SQL query logs."},"warnings":[{"fix":"Set DEBUG=True in your settings or use a different tool for production profiling.","message":"The middleware only works with Django's DEBUG=True because it uses django.db.connection.queries, which is only populated when DEBUG is True.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using django-debug-toolbar or django-silk for active development and support.","message":"This library has not been updated since 2019 and does not officially support Django 3.0+ or Python 3.8+. It may still work with modern Django but is not tested.","severity":"deprecated","affected_versions":"Django >=3.0, Python >=3.8"},{"fix":"Ensure your database backend populates connection.queries (default Django backends do).","message":"If you use a custom database backend that does not set django.db.connection.queries, the middleware will not capture any queries.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Make sure you have at least one database in DATABASES settings and the connection is established.","cause":"The middleware accesses connection.queries but Django's connection object may be None if no database is configured.","error":"AttributeError: 'NoneType' object has no attribute 'queries'"},{"fix":"Use correct import: 'from queryinspect.middleware import QueryInspectMiddleware'","cause":"Import path used is 'django_queryinspect' instead of 'queryinspect'.","error":"ModuleNotFoundError: No module named 'queryinspect'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}