Re: [Django] #29172: Using Window in Subquery causes AttributeError

2018-03-01 Thread Django
#29172: Using Window in Subquery causes AttributeError
-+-
 Reporter:  Tomáš Ehrlich|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  subquery window  | Triage Stage:  Ready for
  expression orm |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham ):

 In [changeset:"3cdc88ba5305f8653fdd1afa36ba9d4d83c426bf" 3cdc88b]:
 {{{
 #!CommitTicketReference repository=""
 revision="3cdc88ba5305f8653fdd1afa36ba9d4d83c426bf"
 [2.0.x] Fixed #29172 -- Fixed crash with Window expression in a subquery.

 Backport of fa352626c2a80bcdcd0fc6492b5fd5130490f05e from master
 }}}

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


Re: [Django] #29172: Using Window in Subquery causes AttributeError

2018-03-01 Thread Django
#29172: Using Window in Subquery causes AttributeError
-+-
 Reporter:  Tomáš Ehrlich|Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  subquery window  | Triage Stage:  Ready for
  expression orm |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

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


Comment:

 In [changeset:"fa352626c2a80bcdcd0fc6492b5fd5130490f05e" fa352626]:
 {{{
 #!CommitTicketReference repository=""
 revision="fa352626c2a80bcdcd0fc6492b5fd5130490f05e"
 Fixed #29172 -- Fixed crash with Window expression in a subquery.
 }}}

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


Re: [Django] #29172: Using Window in Subquery causes AttributeError

2018-03-01 Thread Django
#29172: Using Window in Subquery causes AttributeError
-+-
 Reporter:  Tomáš Ehrlich|Owner:  nobody
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  subquery window  | Triage Stage:  Ready for
  expression orm |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * stage:  Accepted => Ready for checkin


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


Re: [Django] #29172: Using Window in Subquery causes AttributeError

2018-03-01 Thread Django
#29172: Using Window in Subquery causes AttributeError
-+-
 Reporter:  Tomáš Ehrlich|Owner:  nobody
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  subquery window  | Triage Stage:  Accepted
  expression orm |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * stage:  Unreviewed => Accepted


Comment:

 This seems reasonable yes. Test case from PR ''should'' work:


 {{{
 subquery_qs = Employee.objects.annotate(
 highest=Window(FirstValue('id'), partition_by=F('department'),
 order_by=F('salary').desc())
 ).values('highest')

 highest_salary = Employee.objects.filter(pk__in=subquery_qs)
 }}}

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


Re: [Django] #29172: Using Window in Subquery causes AttributeError

2018-02-28 Thread Django
#29172: Using Window in Subquery causes AttributeError
-+-
 Reporter:  Tomáš Ehrlich|Owner:  nobody
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  subquery window  | Triage Stage:
  expression orm |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tomáš Ehrlich):

 * has_patch:  0 => 1


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


[Django] #29172: Using Window in Subquery causes AttributeError

2018-02-28 Thread Django
#29172: Using Window in Subquery causes AttributeError
-+-
   Reporter:  Tomáš  |  Owner:  nobody
  Ehrlich|
   Type:  Bug| Status:  assigned
  Component:  Database   |Version:  2.0
  layer (models, ORM)|   Keywords:  subquery window
   Severity:  Normal |  expression orm
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 Using Window expression within Subquery causes an `AttributeError:
 'NoneType' object has no attribute ‘relabeled_clone'`

 Error is raised in `relabeled_clone` method,
 
https://github.com/django/django/blob/master/django/db/models/expressions.py#L319
 which calls `e.relabeled_clone` method on every expression returned from
 `get_source_expressions`.

 Window expression returns `source_expression`, `partition_by`, `order_by`
 and `frame` in `get_source_expression`:
 
https://github.com/django/django/blob/master/django/db/models/expressions.py#L1188
 but all parameters except `source_expression` are optional and might be
 `None`. This leads to AttributeError.

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