Re: [Django] #20930: Arithmetic operations on aggregates

2014-08-31 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:  duplicate
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  aggregate, annotate  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by timgraham):

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


--
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/067.17572b1fae0cc6c330d53f2c4734d427%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #20930: Arithmetic operations on aggregates

2014-08-31 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  aggregate, annotate  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by jarshwah):

 FYI - the implementation of #14030 satisfies this ticket.

--
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/067.b5bfc989c2df3395b5a58c444f46dc6e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #20930: Arithmetic operations on aggregates

2014-06-24 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  aggregate, annotate  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by jorgecarleitao):

 * cc: jorgecarleitao@… (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 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/067.d90d2a12be4cfa1f02b0f1fee4ab673c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-09-20 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  aggregate, annotate  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by debanshuk):

 * owner:  debanshuk =>
 * status:  assigned => new


-- 
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/067.6f1ae805c75e7ce25e9d7728ee5ba864%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-24 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  debanshuk
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  aggregate, annotate  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by debanshuk):

 Did amendment in the commit. Updated some conditions in test-cases to make
 them more reliable.

-- 
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/067.75bd289fd96b6bae914dd71008341af6%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-23 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  debanshuk
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  aggregate, annotate  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by debanshuk):

 Added pull request https://github.com/django/django/pull/1510. Fixed code
 and added tests and docs.

-- 
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/067.6c766891c6c8797801d925337fa6ae89%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-23 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  debanshuk
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  aggregate, annotate  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by debanshuk):

 * status:  new => assigned
 * owner:  nobody => debanshuk


-- 
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/067.0e47eb161d78be68ac0faed7905f4d30%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-20 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:  aggregate, annotate  |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by apollo13):

 * needs_better_patch:  0 => 1
 * needs_docs:  0 => 1
 * needs_tests:  0 => 1
 * 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 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/067.1e865eb988afc61be38716703a71196c%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-19 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  aggregate, annotate  |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by debanshuk):

 Well...not exactly duplicate, as #14030 is for something like this:

 {{{
 Xyz.objects.aggregate(Sum(F('a')/F('b')*100))
 }}}

 but I guess #14030 can be extended to implement functionality of this
 ticket. In case of `annotate` something like this can be done:

 {{{
 Xyz.objects.values('user').annotate(total_a=Sum('a'),
 total_b=Sum('b')).values(F('total_a')/F('total_b')*100)
 }}}

 **But**, in case of `aggregate` this wont work as `aggregate` returns
 `dict` (not `QuerySet`). So, I guess some changes are required for
 `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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.3ce42706c8f65715648fe84357034aca%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-19 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  aggregate, annotate  |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by timo):

 Duplicate of #14030?

-- 
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/067.f9df14537289f185f1fe18c4d5f45f87%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-18 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  aggregate, annotate  |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by debanshuk):

 Hi Wim,

 In the example given in the description, it would. And I guess in case of
 aggregates it would always be possible to make the calculations out side
 aggregate.
 But, '''in case of annotate it would not'''. Well, it would certainly be
 possible, but wouldn’t be cleaner, as one would have to do the
 calculations for each element in resultant query-set.

 Eg. Let modified `Xyz` be:

 {{{
 class Xyz(models.Model):
 user = models.ForeignKey(User)

 a = models.IntegerField()
 b = models.IntegerField()
 }}}

 Now if I want to find find percent ratio of sum of all `a` and sum of all
 `b` of a `user`, for each `user`. I may write:

 {{{
 Xyz.objects.values('user').annotate(ratio_percent=Sum('a')/Sum('b')*100)
 }}}

 Currently, to do this (without writing raw SQL), one would have to do
 something like:

 {{{
 result = Xyz.objects.values('user').annotate(total_a=Sum('a'),
 total_b=Sum('b'))
 final_result = [{'user': r['user'], 'ratio_percent':
 r['total_a']/r['total_b']*100} for r in result]
 }}}


 '''Also''', If someone want to aggregate over annotation results, like in
 the example if I want to find maximum of the ratio_percentage, I may do:

 {{{
 
Xyz.objects.values('user').annotate(ratio_percent=Sum('a')/Sum('b')*100).aggregate(Max('ratio_percent'))
 }}}

 Currently, I would have to do:

 {{{
 result = Xyz.objects.values('user').annotate(total_a=Sum('a'),
 total_b=Sum('b'))
 final_result = max(r['total_a']/r['total_b']*100 for r in result)
 }}}

 '''In the second one, max calculation in done in python. In the first one
 it is done in SQL itself.'''

-- 
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/067.19a258787a07d5e5d3d2de7c83ebbab8%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-18 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  aggregate, annotate  |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by wim@…):

 Hi debanshuk,

 Wouldn't it be possible to make the same calculation outside of the
 aggregate? That seems cleaner to me.

 Wim

-- 
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/067.62d12f7b75ad6147ecac57297ca8a2eb%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-17 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:  aggregate, annotate  |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by debanshuk):

 * keywords:   => aggregate, annotate


-- 
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/067.da7257a31ed5e7f322649dcf14ba2c9e%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #20930: Arithmetic operations on aggregates

2013-08-17 Thread Django
#20930: Arithmetic operations on aggregates
-+-
 Reporter:  debanshuk|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |   Resolution:
 Severity:  Normal   | Triage Stage:
 Keywords:   |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by debanshuk):

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


Comment:

 Also added pull request https://github.com/django/django/pull/1484

-- 
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/067.bfc68185d588d9255dcac027199e16da%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.