Code

Opened 2 years ago

Closed 2 years ago

#17844 closed Uncategorized (invalid)

Propose to add generated sql queries in the doc of aggregation/annotation

Reported by: peebor@… Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords: query aggregate annotate raw
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm currently trying to figure out how to write the correct and efficient query using annotation; much like the example in:

https://docs.djangoproject.com/en/1.3/topics/db/aggregation/

Book.objects.annotate(num_authors=Count('authors')).order_by('num_authors')

Thing is that i know the raw query i want to have but have trouble describing it with the db api; (which i do prefer over inserting raw sql using extra). It may help when the examples are extended with the generated/raw sql queries: select .... etc.

Attachments (0)

Change History (1)

comment:1 Changed 2 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

If you have questions about how to use Django, please ask on the Django Users mailing list. Trac is for registering known bugs so that we can ensure that they are resolved.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.