#33835: Select_related().only() in the Prefetch() should automatically add
primary
keys for reverse relations.
-------------------------------------+-------------------------------------
Reporter: Ipakeev | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution: wontfix
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 Mariusz Felisiak):
* cc: Simon Charette (added)
* status: new => closed
* type: Bug => New feature
* resolution: => wontfix
Comment:
Thanks for this proposition, however, `prefetch_related_objects()`
shouldn't implicitly add any columns, this could be unexpected and
misleading. Users who use `only()`/`defer()` are fully responsible for
providing a proper set of columns, see
[https://docs.djangoproject.com/en/stable/ref/models/querysets/#defer a
note in docs]:
> ''"The `defer()` method (and its cousin, `only()`, below) are only for
advanced use-cases. They provide an optimization for when you have
analyzed your queries closely and understand exactly what information you
need and have measured that the difference between returning the fields
you need and the full set of fields for the model will be significant."''
--
Ticket URL: <https://code.djangoproject.com/ticket/33835#comment:1>
Django <https://code.djangoproject.com/>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070181ecb5ba0c-bc9ea71a-c38b-42cb-9ae1-90b474884365-000000%40eu-central-1.amazonses.com.