Opened 12 years ago

Closed 19 months ago

#18631 closed New feature (wontfix)

A way to get handle to the generated query for terminal queryset methods

Reported by: Anssi Kääriäinen Owned by: nobody
Component: Database layer (models, ORM) Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When debugging or testing generated ORM queries it is often useful to get a handle to generated queryset from terminal qs methods (like .update() or .aggregate()) instead of executing the query.

The attached proof-of-concept shows a way to achieve this.

Attachments (1)

ticket_18631_poc.diff (2.7 KB ) - added by Anssi Kääriäinen 12 years ago.

Download all attachments as: .zip

Change History (5)

by Anssi Kääriäinen, 12 years ago

Attachment: ticket_18631_poc.diff added

comment:1 by Jason Mayfield, 12 years ago

Cc: jason@… added
Triage Stage: UnreviewedDesign decision needed

comment:2 by Jason Mayfield, 12 years ago

Cc: jason@… removed
Triage Stage: Design decision neededUnreviewed

comment:3 by Anssi Kääriäinen, 11 years ago

Triage Stage: UnreviewedAccepted

I am marking this as accepted.

I am not sure if the attached patch is the right way to do this. But some way to do this would be nice for debugging purposes.

comment:4 by Simon Charette, 19 months ago

Resolution: wontfix
Status: newclosed

I'm not sure this worth keeping around.

Terminal operations such as update and delete can actually result in multiple queries (MTI in the case of update, chain of SELECT and DELETE in the case of delete where the SELECT must run to return the actual data that would be passed to DELETE) and the cases where you want to know the exact queries are better served through django.db logger capture or using options such as --debug-sql when running tests.

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