Opened 15 years ago
Closed 9 years ago
#11671 closed Bug (wontfix)
Aggregations add extra values to ValuesQuerySets :: another usecase
Reported by: | Owned by: | ||
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | QuerySet.extra |
Cc: | klemens@…, jorgecarleitao@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Looking at #10132 I see a similar complaint, however, in this case... the extra.select variable is not included in the values/group_by but is annotated.
>>> qs = TblCdr.objects.extra(select={'billable':'IF(billsec=0,0,1)'},).values('network').annotate(Sum('billable') ... ) Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 580, in annotate is_summary=False) File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py", line 1471, in add_aggregate field_list, opts, self.get_initial_alias(), False) File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py", line 1737, in setup_joins "Choices are: %s" % (name, ", ".join(names))) FieldError: Cannot resolve keyword 'billable' into field. Choices are: billsec, cause, cli, codec, country_code, dcontext, disposition, dst, duration, end, id, ip, lastapp, network, note, start, supplier
Change History (12)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 15 years ago
Component: | Uncategorized → ORM aggregation |
---|---|
Owner: | removed |
comment:3 by , 15 years ago
Cc: | added |
---|
comment:4 by , 15 years ago
comment:5 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:6 by , 14 years ago
Version: | 1.1 → SVN |
---|
Patching this would be very helpfull as, this feature would be usefull in clustering (geodjango)
e.objects.extra(select={'cluster':'substring(mortons_code for 10)'}).annotate(objects_in_cluster=Count('cluster')).order_by('objects_in_cluster')
same error:
FieldError: Cannot resolve keyword 'cluster' into field. Choices are:
.....
comment:9 by , 12 years ago
Component: | ORM aggregation → Database layer (models, ORM) |
---|
comment:10 by , 10 years ago
Cc: | added |
---|
comment:11 by , 9 years ago
Keywords: | QuerySet.extra added |
---|
comment:12 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
We are no longer fixing bugs with QuerySet.extra()
per discussion on django-developers.
Note:
See TracTickets
for help on using tickets.
don't know, but i think i have the same problem #13363. the exception is very similar.
is it complex to create a patch for this, or is it just something nobody did yet?