Re: [Django] #16409: `defer()` and `only()` don't play nice with `annotate()`

2012-02-11 Thread Django
#16409: `defer()` and `only()` don't play nice with `annotate()`
-+-
 Reporter:  mrmachine|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  GIS  |  Version:  SVN
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  annotate defer only  | Triage Stage:  Accepted
  count  |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by ramiro):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [17506]:
 {{{
 #!CommitTicketReference repository="" revision="17506"
 Fixed #16409 (again, this time for GeoDjango).

 Thanks Aymeric Augustin for the regression test and Petr Gorodechnyj for
 the patch.

 Refs r16522.
 }}}

-- 
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 this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16409: `defer()` and `only()` don't play nice with `annotate()`

2011-11-27 Thread Django
#16409: `defer()` and `only()` don't play nice with `annotate()`
-+-
 Reporter:  mrmachine|Owner:  nobody
 Type:  Bug  |   Status:  reopened
Component:  GIS  |  Version:  SVN
 Severity:  Normal   |   Resolution:
 Keywords:  annotate defer only  | Triage Stage:  Accepted
  count  |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by aaugustin):

 * component:  Database layer (models, ORM) => GIS


-- 
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 this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16409: `defer()` and `only()` don't play nice with `annotate()`

2011-11-10 Thread Django
#16409: `defer()` and `only()` don't play nice with `annotate()`
-+-
 Reporter:  mrmachine|Owner:  nobody
 Type:  Bug  |   Status:  reopened
Component:  Database layer   |  Version:  SVN
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  annotate defer only  |  Needs documentation:  0
  count  |  Patch needs improvement:  0
Has patch:  1|UI/UX:  0
  Needs tests:  0|
Easy pickings:  0|
-+-
Changes (by aaugustin):

 * stage:  Unreviewed => Accepted


Comment:

 Indeed — I just attached a failing test case.

-- 
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 this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16409: `defer()` and `only()` don't play nice with `annotate()`

2011-10-28 Thread Django
#16409: `defer()` and `only()` don't play nice with `annotate()`
-+-
 Reporter:  mrmachine|Owner:  nobody
 Type:  Bug  |   Status:  reopened
Component:  Database layer   |  Version:  SVN
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  annotate defer only  |  Unreviewed
  count  |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by Petr Gorodechnyj ):

 * status:  closed => reopened
 * cc: petr.gorodechnyj@… (added)
 * resolution:  fixed =>


Comment:

 OK, you did that all right, but now do the same for the GeoQuerySet
 please. If I call GeoManager's defer(), only() or values() I get the same
 problem that was fixed in the patch above.

-- 
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 this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16409: `defer()` and `only()` don't play nice with `annotate()`

2011-07-06 Thread Django
#16409: `defer()` and `only()` don't play nice with `annotate()`
-+-
   Reporter:  mrmachine  |  Owner:  nobody
   Type:  Bug| Status:  closed
  Milestone:  1.4|  Component:  Database layer
Version:  SVN|  (models, ORM)
 Resolution:  fixed  |   Severity:  Normal
   Triage Stage: |   Keywords:  annotate defer only
  Unreviewed |  count
Needs documentation:  0  |  Has patch:  1
Patch needs improvement:  0  |Needs tests:  0
  UI/UX:  0  |  Easy pickings:  0
-+-
Changes (by ramiro):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [16522]:
 {{{
 #!CommitTicketReference repository="" revision="16522"
 Fixed #16409 -- Fixed an error condition when using QuerySet
 only()/defer() on the result of an annotate() call. Thanks jaklaassen AT
 gmail DOT com and Tai Lee for the reports and Tai for the patch.
 }}}

-- 
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 this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16409: `defer()` and `only()` don't play nice with `annotate()`

2011-07-05 Thread Django
#16409: `defer()` and `only()` don't play nice with `annotate()`
-+-
   Reporter:  mrmachine  |  Owner:  nobody
   Type:  Bug| Status:  new
  Milestone:  1.4|  Component:  Database layer
Version:  SVN|  (models, ORM)
 Resolution: |   Severity:  Normal
   Triage Stage: |   Keywords:  annotate defer only
  Unreviewed |  count
Needs documentation:  0  |  Has patch:  1
Patch needs improvement:  0  |Needs tests:  0
  UI/UX:  0  |  Easy pickings:  0
-+-

Comment (by mrmachine):

 Updated tests to use `assertIsInstance`. The test checks that the queryset
 can be successfully iterated through without raising an exception by
 converting it to a list.

-- 
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 this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16409: `defer()` and `only()` don't play nice with `annotate()`

2011-07-05 Thread Django
#16409: `defer()` and `only()` don't play nice with `annotate()`
-+-
   Reporter:  mrmachine  |  Owner:  nobody
   Type:  Bug| Status:  new
  Milestone:  1.4|  Component:  Database layer
Version:  SVN|  (models, ORM)
 Resolution: |   Severity:  Normal
   Triage Stage: |   Keywords:  annotate defer only
  Unreviewed |  count
Needs documentation:  0  |  Has patch:  1
Patch needs improvement:  0  |Needs tests:  0
  UI/UX:  0  |  Easy pickings:  0
-+-
Changes (by mrmachine):

 * needs_better_patch:  1 => 0


Comment:

 Updated patch to include a fix. Hopefully good to go.

-- 
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 this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16409: `defer()` and `only()` don't play nice with `annotate()`

2011-07-05 Thread Django
#16409: `defer()` and `only()` don't play nice with `annotate()`
-+-
   Reporter:  mrmachine  |  Owner:  nobody
   Type:  Bug| Status:  new
  Milestone:  1.4|  Component:  Database layer
Version:  SVN|  (models, ORM)
 Resolution: |   Severity:  Normal
   Triage Stage: |   Keywords:  annotate defer only
  Unreviewed |  count
Needs documentation:  0  |  Has patch:  1
Patch needs improvement:  1  |Needs tests:  0
  UI/UX:  0  |  Easy pickings:  0
-+-
Changes (by mrmachine):

 * needs_docs:   => 0
 * has_patch:  0 => 1
 * needs_tests:   => 0
 * needs_better_patch:   => 1


Comment:

 Added a patch with a failing test case.

 {{{
 Creating test database for alias 'default'...
 Creating test database for alias 'other'...
 E
 ==
 ERROR: test_defer (modeltests.defer.tests.DeferTests)
 --
 Traceback (most recent call last):
   File
 "/Users/mrmachine/Subversion/django/tests/modeltests/defer/tests.py", line
 141, in test_defer
 
self.assertEqual(len(Secondary.objects.annotate(Count('primary')).defer('first')),
 1)
   File "/Users/mrmachine/Subversion/django/django/db/models/query.py",
 line 82, in __len__
 self._result_cache = list(self.iterator())
   File "/Users/mrmachine/Subversion/django/django/db/models/query.py",
 line 300, in iterator
 setattr(obj, aggregate, row[i+aggregate_start])
 IndexError: tuple index out of range

 --
 Ran 1 test in 0.120s

 FAILED (errors=1)
 Destroying test database for alias 'default'...
 Destroying test database for alias 'other'...
 }}}

-- 
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 this group at 
http://groups.google.com/group/django-updates?hl=en.



[Django] #16409: `defer()` and `only()` don't play nice with `annotate()`

2011-07-05 Thread Django
#16409: `defer()` and `only()` don't play nice with `annotate()`
-+-
 Reporter:  mrmachine|  Owner:  nobody
 Type:  Bug  | Status:  new
Milestone:  1.4  |  Component:  Database layer
  Version:  SVN  |  (models, ORM)
 Keywords:  annotate defer only  |   Severity:  Normal
  count  |   Triage Stage:  Unreviewed
Has patch:  0|  Easy pickings:  0
UI/UX:  0|
-+-
 When adding `defer()` or `only()` to an existing query that used
 `annotate()` to cut out some fields, I started getting IndexError
 exceptions.

 At first, I thought it was due to `aggregate_start` not being reduced by
 the number of deferred fields in `QuerySet.iterator()`, but when I looked
 at the SQL being generated I saw that ALL fields were being dropped from
 the query, except for the annotation. I suspect that even if this is
 fixed, `aggregate_start` will also need to be reduced by the number of
 deferred fields.

 Here's the traceback:

 {{{
 >>> from django.db.models import Count
 >>> from django.contrib.auth.models import *
 >>> from django.contrib.admin.models import *
 >>> User.objects.annotate(Count('logentry'))
 [, , , ,
 , , , ,
 , , , ,
 , , , ,
 , , , , '...(remaining elements truncated)...']
 >>> User.objects.annotate(Count('logentry')).defer('first_name')
 Traceback (most recent call last):
   File "", line 1, in 
   File "/Users/mrmachine/myproject/django/db/models/query.py", line 69, in
 __repr__
 data = list(self[:REPR_OUTPUT_SIZE + 1])
   File "/Users/mrmachine/myproject/django/db/models/query.py", line 84, in
 __len__
 self._result_cache.extend(self._iter)
   File "/Users/mrmachine/myproject/django/db/models/query.py", line 300,
 in iterator
 setattr(obj, aggregate, row[i+aggregate_start])
 IndexError: tuple index out of range
 }}}

 Here's the generated SQL:

 {{{
 >>> str(User.objects.annotate(Count('logentry')).query)
 'SELECT "auth_user"."id", "auth_user"."username",
 "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email",
 "auth_user"."password", "auth_user"."is_staff", "auth_user"."is_active",
 "auth_user"."is_superuser", "auth_user"."last_login",
 "auth_user"."date_joined", COUNT("django_admin_log"."id") AS
 "logentry__count" FROM "auth_user" LEFT OUTER JOIN "django_admin_log" ON
 ("auth_user"."id" = "django_admin_log"."user_id") GROUP BY
 "auth_user"."id", "auth_user"."username", "auth_user"."first_name",
 "auth_user"."last_name", "auth_user"."email", "auth_user"."password",
 "auth_user"."is_staff", "auth_user"."is_active",
 "auth_user"."is_superuser", "auth_user"."last_login",
 "auth_user"."date_joined"'
 >>>
 str(User.objects.annotate(Count('logentry')).defer('first_name').query)
 'SELECT COUNT("django_admin_log"."id") AS "logentry__count" FROM
 "auth_user" LEFT OUTER JOIN "django_admin_log" ON ("auth_user"."id" =
 "django_admin_log"."user_id") GROUP BY "auth_user"."id",
 "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name",
 "auth_user"."email", "auth_user"."password", "auth_user"."is_staff",
 "auth_user"."is_active", "auth_user"."is_superuser",
 "auth_user"."last_login", "auth_user"."date_joined"'
 }}}

-- 
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 this group at 
http://groups.google.com/group/django-updates?hl=en.