Opened 16 years ago

Last modified 8 years ago

#9363 new New feature

Add a traceback to each query in CursorDebugWrapper

Reported by: Gergely Kontra Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Normal Keywords: debug, query
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I'm not a python wizard, so I'm just suspecting the following is possible:

When you examine connection.queries, it would be great to write out the file and the line, from the Query comes from.
Ok, one must define where the query created (the first time you say filter on a manager, the last time ...), but this should help greatly figuring out why certain queries are executed.

Change History (10)

comment:1 by Jacob, 16 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Luke Plant, 14 years ago

Severity: Normal
Type: New feature

comment:3 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:4 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:5 by Claude Paroz, 11 years ago

#22320 was a duplicate with a patch. I think the idea is good, however I'm a bit worried about the memory consumption, even if production sites should not be affected. IMO, fixing #12581 is a prerequisite to this one.

comment:7 by Claude Paroz, 11 years ago

Has patch: set

comment:8 by Aymeric Augustin, 11 years ago

Resolution: wontfix
Status: newclosed

This feature is provided by the Django Debug Toolbar. It even works for templates. If you need this feature, just install the Debug Toolbar.

I know what the code looks like, and I'd rather leave it up to third-parties...

comment:9 by Malcolm Box, 10 years ago

Django debug toolbar doesn't help for any situation where you're not running via a web browser, or in a non-request cycle. So for example, any test case that uses assertNumQueries (see #22320 for example)

The patch for this is a simple few lines, so I don't understand your concern about "what the code looks like"

comment:10 by Tim Graham, 8 years ago

Patch needs improvement: set
Resolution: wontfix
Status: closednew
Summary: [feature request] track down where a query is requested for debuggingAdd a traceback to each query in CursorDebugWrapper

Aymeric withdraws his wontfix.

PR with a few comments for improvement.

Note: See TracTickets for help on using tickets.
Back to Top