Opened 13 years ago
Closed 13 years ago
#17844 closed Uncategorized (invalid)
Propose to add generated sql queries in the doc of aggregation/annotation
Reported by: | 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.
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.