Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-24 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by felixxm):

 * version:  2.2 => master


Comment:

 Django 3.0 should appear in December 2019.

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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-24 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Artem Nesterenko):

 Replying to [comment:11 felixxm]:
 > No, it doesn't qualify for the backport.
 When it is expected to publish the changes to PyPi? I would like to use a
 subquery in my annotation and this bug will affect the request performance
 dramatically.

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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-24 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by felixxm):

 No, it doesn't qualify for the backport.

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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-24 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Artem Nesterenko):

 Replying to [comment:9 Simon Charette]:
 > Confirmed this is fixed against `master` with models matching the
 queried fields.
 Great news! Will these changes be included in the 2.2.1 release?

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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-23 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

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


Comment:

 Confirmed this is fixed against `master` with models matching the queried
 fields.

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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-23 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 It looks like one of your project's `INSTALLED_APPS` doesn't support
 Django `master` yet. Could you possible provide the exact set of models to
 perform the queryset operation on.

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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-23 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Artem Nesterenko):

 Replying to [comment:6 Simon Charette]:
 > Could you try against the `master` branch? There was a few recent
 changes around grouping and aliasing that probably addressed this issue.
 I tried to do it by executing `pip install -U
 git+https://github.com/django/django.git` but got
 {{{#!python
 Traceback (most recent call last):
   File "./src/manage.py", line 17, in 
 main()
   File "./src/manage.py", line 11, in main
 from configurations.management import execute_from_command_line
   File "/usr/local/lib/python3.7/site-
 packages/configurations/__init__.py", line 2, in 
 from .base import Configuration
   File "/usr/local/lib/python3.7/site-packages/configurations/base.py",
 line 4, in 
 from django.utils import six
 ImportError: cannot import name 'six' from 'django.utils'
 (/usr/local/lib/python3.7/site-packages/django/utils/__init__.py)
 }}}

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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-19 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 Could you try against the `master` branch? There was a few recent changes
 around grouping and aliasing that probably addressed this 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/063.984046759f93708b51f16fb43fdd0713%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-19 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  2.2
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by artemnesterenko):

 * version:  1.9 => 2.2


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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2019-04-19 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.9
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by artemnesterenko):

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


Comment:

 I confirm that this behavior is still taking place in Django 2.2.
 {{{#!python
   class CustomQuerySet(QuerySet):
 def annotate_statuses(self):
 moment = now()
 return self.annotate(
 status=Case(
 When(
 timestamp__lte=moment
 -
 timedelta(seconds=settings.OFFLINE_SECONDS_THRESHOLD),
 then=Value("OFFLINE"),
 ),
 When(
 idle__gte=settings.IDLE_SECONDS_THRESHOLD,
 then=Value("IDLE"),
 ),
 default=Value("ACTIVE"),
 output_field=CharField(),
 )
 )
 }}}
 Having this queryset the query:
 {{{#!python
 
Model.objects.annotate_statuses().values("status").annotate(count=Count("status"))
 }}}
 generates the following sql:
 {{{#!sql
 SELECT CASE
WHEN "my_table"."timestamp" <=
 '2019-04-19T09:23:04.681449+00:00'::timestamptz THEN 'OFFLINE'
WHEN "my_table"."idle" >= 300.0 THEN 'IDLE'
ELSE 'ACTIVE' ENDAS "status",
COUNT(CASE
  WHEN "my_table"."timestamp" <=
 '2019-04-19T09:23:04.681449+00:00'::timestamptz THEN 'OFFLINE'
  WHEN "my_table"."idle" >= 300.0 THEN 'IDLE'
  ELSE 'ACTIVE' END) AS "count"
 FROM "my_table"
 GROUP BY CASE
  WHEN "my_table"."timestamp" <=
 '2019-04-19T09:23:04.681449+00:00'::timestamptz THEN 'OFFLINE'
  WHEN "my_table"."idle" >= 300.0 THEN 'IDLE'
  ELSE 'ACTIVE' END;
 }}}
 I expect it to generate something similar to:
 {{{#!sql
 select count(*), status
 from (select CASE
  WHEN (timestamp <=
 '2019-04-19T09:23:04.681449+00:00'::timestamptz)
  THEN 'OFFLINE'
  WHEN (idle >= 300.0) THEN 'IDLE'
  ELSE 'ACTIVE' END as status
   from my_table
  )
 group by status;
 }}}

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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2016-05-26 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.9
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

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


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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2016-05-24 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.9
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by jarshwah):

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


Re: [Django] #26658: "When Case" query generating rule in duplicate

2016-05-24 Thread Django
#26658: "When Case" query generating rule in duplicate
-+-
 Reporter:  imaia|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.9
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by jarshwah):

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


Comment:

 Can you please provide more information, like the SQL you're seeing and
 the SQL you expect?

 Also, When(Case()) isn't valid. When are child objects of Case. I think
 your ordering of values() clauses is also off. The query should be
 something like:

 {{{
 Model.objects.annotate(value=Case(When(something=number, then=1),
 default=0, output_field=IntegerField())).values('field',
 'value').annotate(count=Count('field'), mysum=Sum('value'))

 }}}

 A `values()` clause implies the grouping (in GROUP BY). By annotating a
 non-aggregate later you mess with the grouping and the select list. Can
 you try this query above, and respond with the actual sql and desired sql
 if there's still an issue please?
 I'm not sure if what you wrote is just a typo or not,

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