Re: [Django] #12886: .aggregate() does not honour sliced queryset

2014-11-15 Thread Django
#12886: .aggregate() does not honour sliced queryset
-+-
 Reporter:  til@…|Owner:  Anssi
 Type:  Bug  |  Kääriäinen 
Component:  Database layer   |   Status:  closed
  (models, ORM)  |  Version:  1.4
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  aggregate| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by reinout):

 Note: the fix here *does* fix #15101 (django.contrib.gis' "Extent"
 aggregate had the same issue).

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.2ea6f7eb0d424355a744aa1c31db8334%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #12886: .aggregate() does not honour sliced queryset

2014-11-15 Thread Django
#12886: .aggregate() does not honour sliced queryset
-+-
 Reporter:  til@…|Owner:  Anssi
 Type:  Bug  |  Kääriäinen 
Component:  Database layer   |   Status:  closed
  (models, ORM)  |  Version:  1.4
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  aggregate| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by reinout):

 See #23836: the fix doesn't work when aggregating on a related object.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.d9884e55213029fff9e02cca3479bd66%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #12886: .aggregate() does not honour sliced queryset

2014-02-26 Thread Django
#12886: .aggregate() does not honour sliced queryset
-+-
 Reporter:  til@…|Owner:  Anssi
 Type:  Bug  |  Kääriäinen 
Component:  Database layer   |   Status:  closed
  (models, ORM)  |  Version:  1.4
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  aggregate| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by akaariai):

 The fix is only in Django 1.7+.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.ff7a4a812813ca4465229a71d8524d21%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #12886: .aggregate() does not honour sliced queryset

2014-02-26 Thread Django
#12886: .aggregate() does not honour sliced queryset
-+-
 Reporter:  til@…|Owner:  Anssi
 Type:  Bug  |  Kääriäinen 
Component:  Database layer   |   Status:  closed
  (models, ORM)  |  Version:  1.4
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  aggregate| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by devin.barry@…):

 This bug still exists. I am using Django 1.6 on Python 2.6 and both Sum
 and Avg use the entire query set instead of the sliced query set. Threw in
 an annotate() as mentioned and this fixed it all up. Someone should open
 this up again, it has NOT been fixed!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.e07f1ac2a846349eec1a556a71e01fb6%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #12886: .aggregate() does not honour sliced queryset

2013-08-19 Thread Django
#12886: .aggregate() does not honour sliced queryset
-+-
 Reporter:  til@…|Owner:  Anssi
 Type:  Bug  |  Kääriäinen 
Component:  Database layer   |   Status:  closed
  (models, ORM)  |  Version:  1.4
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  aggregate| Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Anssi Kääriäinen ):

 * status:  new => closed
 * owner:   => Anssi Kääriäinen 
 * resolution:   => fixed


Comment:

 In [changeset:"7737305a4f5dc5006d92dac3a61523ad6c2a523a"]:
 {{{
 #!CommitTicketReference repository=""
 revision="7737305a4f5dc5006d92dac3a61523ad6c2a523a"
 Fixed #12886 -- aggregation over sliced queryset
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.3bc56ed40dfdce35e924ebd6a0377137%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #12886: .aggregate() does not honour sliced queryset

2013-03-10 Thread Django
#12886: .aggregate() does not honour sliced queryset
-+-
 Reporter:  til@…|Owner:
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.4
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  aggregate|  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by fhahn):

 * keywords:   => aggregate


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #12886: .aggregate() does not honour sliced queryset

2012-11-07 Thread Django
#12886: .aggregate() does not honour sliced queryset
-+
 Reporter:  til@…|Owner:
 Type:  Bug  |   Status:  new
Component:  ORM aggregation  |  Version:  1.4
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by davidpope):

 * version:  1.2-beta => 1.4


Comment:

 This seems like a fairly significant limitation.  As far as I can see, I
 cannot have the database perform aggregate functions on queries with LIMIT
 clauses, e.g. "show me the max date for the top 100 results matching this
 WHERE clause".  This caveat should at least be called out in the
 [https://docs.djangoproject.com/en/dev/ref/models/querysets/
 documentation], since it otherwise implies that slices and aggregates
 should work without issue.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #12886: .aggregate() does not honour sliced queryset

2010-10-07 Thread Django
#12886: .aggregate() does not honour sliced queryset
--+-
  Reporter:  t...@subnetz.org  | Owner:  
Status:  new  | Milestone:  
 Component:  ORM aggregation  |   Version:  1.2-beta
Resolution:   |  Keywords:  
 Stage:  Accepted | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by gruszczy):

 * cc: gruszczy (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #12886: .aggregate() does not honour sliced queryset

2010-10-07 Thread Django
#12886: .aggregate() does not honour sliced queryset
--+-
  Reporter:  t...@subnetz.org  | Owner:  
Status:  new  | Milestone:  
 Component:  ORM aggregation  |   Version:  1.2-beta
Resolution:   |  Keywords:  
 Stage:  Accepted | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Comment (by gruszczy):

 I have managed to patch this, but encountered larger problem, that I have
 problems with. I have added following test to
 modeltests/aggregation/tests.py:

 {{{
 def test_join_annotate_aggregate(self):
 vals =
 Book.objects.all().annotate().aggregate(Max("authors__age"))
 self.assertEqual(len(vals), 1)
 self.assertEqual(vals["authors__age__max"], 57)
 }}}

 and it causes following exception:

 {{{
 ==
 ERROR: test_join_annotate_aggregate
 (modeltests.aggregation.tests.BaseAggregateTestCase)
 --
 Traceback (most recent call last):
   File
 "/home/gruszczy/Programy/django/tests/modeltests/aggregation/tests.py",
 line 21, in test_join_annotate_aggregate
 vals = Book.objects.all().annotate().aggregate(Max("authors__age"))
   File "/home/gruszczy/Programy/django/django/db/models/query.py", line
 312, in aggregate
 return query.get_aggregation(using=self.db)
   File "/home/gruszczy/Programy/django/django/db/models/sql/query.py",
 line 366, in get_aggregation
 result = query.get_compiler(using).execute_sql(SINGLE)
   File "/home/gruszczy/Programy/django/django/db/models/sql/compiler.py",
 line 729, in execute_sql
 cursor.execute(sql, params)
   File
 "/home/gruszczy/Programy/django/django/db/backends/sqlite3/base.py", line
 200, in execute
 return Database.Cursor.execute(self, query, params)
 DatabaseError: no such column: T5.age

 }}}

 Generated SQL looks like this:


 {{{
 SELECT "aggregation_book"."id" AS "id", "aggregation_book"."isbn" AS
 "isbn", "aggregation_book"."name" AS "name", "aggregation_book"."pages" AS
 "pages", "aggregation_book"."rating" AS "rating",
 "aggregation_book"."price" AS "price", "aggregation_book"."contact_id" AS
 "contact_id",
 "aggregation_book"."publisher_id" AS "publisher_id",
 "aggregation_book"."pubdate" AS "pubdate" FROM "aggregation_book" LEFT
 OUTER JOIN
 "aggregation_book_authors" ON ("aggregation_book"."id" =
 "aggregation_book_authors"."book_id") LEFT OUTER JOIN "aggregation_author"
 T5 ON
 ("aggregation_book_authors"."author_id" = T5."id") GROUP BY
 "aggregation_book"."id", "aggregation_book"."isbn",
 "aggregation_book"."name",
 "aggregation_book"."pages", "aggregation_book"."rating",
 "aggregation_book"."price", "aggregation_book"."contact_id",
 "aggregation_book"."publisher_id", "aggregation_book"."pubdate"

 }}}

 I am posting my partial patch with tests, so maybe someone could direct
 me, where I should go from here and how can I solve the encountered bug.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #12886: .aggregate() does not honour sliced queryset

2010-09-09 Thread Django
#12886: .aggregate() does not honour sliced queryset
--+-
  Reporter:  t...@subnetz.org  | Owner:  
Status:  new  | Milestone:  
 Component:  ORM aggregation  |   Version:  1.2-beta
Resolution:   |  Keywords:  
 Stage:  Accepted | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by 3point2):

 * cc: 3point2 (added)

Comment:

 I've also just discovered this issue (using the Sum aggregate) and did
 some poking around: get_aggregate in
 source:django/trunk/django/db/models/sql/query.py calls
 query.clear_limits(). With this line commented out, a query like this is
 issued:
 {{{
 SELECT SUM("accounts_invoice"."grand_total") AS "grand_total__sum" FROM
 "accounts_invoice" LIMIT 5
 }}}
 which seems correct. unfortunately the DB (in my case sqlite) ignores the
 limit for the sum aggregate anyway.

 For this to work right, the sql issued will have to look something like
 {{{
 SELECT SUM("grand_total") AS "grand_total__sum" FROM (SELECT * FROM
 "accounts_invoice" LIMIT 5)
 }}}

 in other words, grab the SQL from the query as if it wasn't an aggregate,
 and then nest it inside the aggregation function.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #12886: .aggregate() does not honour sliced queryset

2010-02-17 Thread Django
#12886: .aggregate() does not honour sliced queryset
--+-
  Reporter:  t...@subnetz.org  | Owner:  
Status:  new  | Milestone:  
 Component:  ORM aggregation  |   Version:  1.2-beta
Resolution:   |  Keywords:  
 Stage:  Accepted | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by russellm):

  * stage:  Unreviewed => Accepted

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



[Django] #12886: .aggregate() does not honour sliced queryset

2010-02-16 Thread Django
#12886: .aggregate() does not honour sliced queryset
--+-
 Reporter:  t...@subnetz.org   |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Database layer (models, ORM)  | Version:  1.2-beta  
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 If I aggregate a sliced queryset, the result is an aggregate across the
 whole unsliced queryset:

 {{{
 In [97]: qs = Encounter.objects.all()

 In [98]: qs.aggregate(**aggregations)
 Out[98]: {'total_no_of_adults': 19, 'total_no_of_children': 8,
 'total_no_of_dogs': 2}

 In [99]: qs[0:5].aggregate(**aggregations)
 Out[99]: {'total_no_of_adults': 19, 'total_no_of_children': 8,
 'total_no_of_dogs': 2}
 }}}

 It works though if .annotate() is called first, even if no annotations are
 given:

 {{{
 In [100]: qs[0:5].annotate().aggregate(**aggregations)
 Out[100]: {'total_no_of_adults': 8, 'total_no_of_children': 8,
 'total_no_of_dogs': 2}
 }}}

 The latter are the correct figures for my example model.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.