#28939: Document which ORM methods provide an instance hint to database routers
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: prefetch, | Triage Stage: Accepted
prefetch_related, using, |
connection |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
Hey Nick!
> It may be worth improving the documentation on database routers and/or
prefetch_related() warning of this pitfall.
I'm not sure how we could improve the current routers documentation given
we link to [https://docs.djangoproject.com/en/2.0/topics/db/multi-
db/#hints hints] in both `db_for_read` and `db_for_write` section but I
guess the `prefetch_related` one and all the other database methods that
provide an `instance` hint to routers could be improved.
I think there would also be benefit in eventually enhancing the routing
context with additional hints such as `operation`, `field`,
`related_instance`, `cardinality` and such. I've had instances in the past
where being able to differentiate between heavy (e.g.
`prefetch_related()`) and lightweight (e.g. `refresh_from_db()`, `get()`)
reads would have been quite useful.
--
Ticket URL: <https://code.djangoproject.com/ticket/28939#comment:3>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.008eb99bc0cc96e6f83183401eee024f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.