Opened 15 years ago
Closed 15 years ago
#12763 closed (duplicate)
Record matching ORM statement in connection.queries for debugging
Reported by: | Daniel Marohn | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | orm debug sql | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As described in the documentation, when DEBUG is true every query that is executed is recorded in django.db.connection.queries. Currently, the raw SQL and the execution time are recorded. It would be useful if the ORM invocation that triggered the execution of the query were also recorded. This would be particularly helpful with views that trigger a large number of query, especially when you have many similar or identical queries and you are trying to find the best places to use select_related or other optimizations.
Attachments (1)
Change History (2)
by , 15 years ago
Attachment: | django_db_debug_query_caller.diff added |
---|
comment:1 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
django-debug-toolbar provides this, and more. We've already got a ticket to track possibly integrating the toolbar into base Django (#11698). I don't believe we want to also consider adding bits piecemeal as well, so I'm going to close this as a dupe of that one.
a simple patch