Re: [Django] #16439: select_related does not work with nullable fields unless field is specified.

2012-09-08 Thread Django
#16439: select_related does not work with nullable fields unless field is
specified.
---+
 Reporter:  dloewenherz|Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  Documentation  |  Version:  1.3
 Severity:  Normal |   Resolution:  fixed
 Keywords:  db | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  1
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+
Changes (by mtredinnick):

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


Comment:

 Quoting from the current documentation
 
(https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_related):

Note that, by default, select_related() does not follow foreign keys
 that have null=True.

 So no documentation patch required. The reason it's like this is because
 nullable joins require an outer join between tables and is sufficiently
 performance impacting to not do by default.

-- 
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] #16439: select_related does not work with nullable fields unless field is specified. (was: select_related does not work with nullable fields)

2011-08-22 Thread Django
#16439: select_related does not work with nullable fields unless field is
specified.
---+---
   Reporter:  dloewenherz  |  Owner:  nobody
   Type:  Bug  | Status:  new
  Milestone:   |  Component:  Documentation
Version:  1.3  |   Severity:  Normal
 Resolution:   |   Keywords:  db
   Triage Stage:  Accepted |  Has patch:  0
Needs documentation:  1|Needs tests:  0
Patch needs improvement:  0|  Easy pickings:  0
  UI/UX:  0|
---+---
Changes (by mtredinnick):

 * needs_docs:  0 => 1
 * component:  Database layer (models, ORM) => Documentation
 * stage:  Design decision needed => Accepted


Comment:

 A documentation patch is welcome for this (although I thought it was
 documented originally; may have been a friendly fire casualty). For
 performance reasons, we will never traverse nullable relations by default,
 as it requires using left outer joins, instead of merely inner joins, and
 the former are significantly slower. It is intentional that you can
 manually tell your code to traverse nullable relations by passing in the
 field names, so there's no behavioural bug here, just a documentation one.

-- 
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] #16439: select_related does not work with nullable fields

2011-07-11 Thread Django
#16439: select_related does not work with nullable fields
-+-
   Reporter: |  Owner:  nobody
  dloewenherz| Status:  new
   Type:  Bug|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  1.3|   Severity:  Normal
 Resolution: |   Keywords:  db
   Triage Stage:  Design |  Has patch:  0
  decision needed|Needs tests:  0
Needs documentation:  0  |  Easy pickings:  0
Patch needs improvement:  0  |
  UI/UX:  0  |
-+-
Changes (by aaugustin):

 * stage:  Unreviewed => Design decision needed


Comment:

 Digging into the docs and code, there is no explanation of this behavior.

 The condition is  in
 `django.db.models.query_utils.select_related_descend`.

-- 
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] #16439: select_related does not work with nullable fields

2011-07-09 Thread Django
#16439: select_related does not work with nullable fields
-+-
   Reporter: |  Owner:  nobody
  dloewenherz| Status:  new
   Type:  Bug|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  1.3|   Severity:  Normal
 Resolution: |   Keywords:  db
   Triage Stage: |  Has patch:  0
  Unreviewed |Needs tests:  0
Needs documentation:  0  |  Easy pickings:  0
Patch needs improvement:  0  |
  UI/UX:  0  |
-+-

Comment (by dloewenherz):

 Thanks for the tip!

 In my actual model there are about 6 `ForeignKey` relationships (all of
 which are accessed for the request). That means I have to manually specify
 each one I want to perform a join on, which is a little tedious/unclean.

-- 
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] #16439: select_related does not work with nullable fields

2011-07-09 Thread Django
#16439: select_related does not work with nullable fields
-+-
   Reporter: |  Owner:  nobody
  dloewenherz| Status:  new
   Type:  Bug|  Component:  Database layer
  Milestone: |  (models, ORM)
Version:  1.3|   Severity:  Normal
 Resolution: |   Keywords:  db
   Triage Stage: |  Has patch:  0
  Unreviewed |Needs tests:  0
Needs documentation:  0  |  Easy pickings:  0
Patch needs improvement:  0  |
  UI/UX:  0  |
-+-
Changes (by AndrewIngram):

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


Comment:

 select_related will follow nullable foreignkeys if you specify the
 fieldname manually, eg:

 {{{
 Books.objects.select_related('owner')
 }}}

 I'm sure there's a good reason why this doesn't happen by default, but the
 behaviour is documented.

-- 
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] #16439: select_related does not work with nullable fields

2011-07-08 Thread Django
#16439: select_related does not work with nullable fields
-+--
 Reporter:  dloewenherz  |  Owner:  nobody
 Type:  Bug  | Status:  new
Milestone:   |  Component:  Database layer (models, ORM)
  Version:  1.3  |   Severity:  Normal
 Keywords:  db   |   Triage Stage:  Unreviewed
Has patch:  0|  Easy pickings:  0
UI/UX:  0|
-+--
 Say I have the following model:


 {{{
 class Book(models.Model):
   owner = models.ForeignKey(Owner, related_name='books')
 }}}


 `Book.objects.select_related()` will pull in all owner data. HOWEVER, when
 the owner field is nullable, no joins occur.

 {{{
 class Book(models.Model):
 owner = models.ForeignKey(Owner, null=True, blank=True,
 related_name='books')
 }}}

 Running a join in my database involving a nullable field works exactly as
 would one on a non-nullable field, so I can't really see a good reason for
 this to happen.

-- 
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.