#28806: Mechanism of fetching related objects violates READ COMMITTED 
assumption of
Django ORM
-------------------------------------+-------------------------------------
     Reporter:  Aaron Tan            |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  database, read-      |             Triage Stage:  Accepted
  committed, concurrency control     |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 I would agree that there is little Django can do here and that we should
 likely close this issue as ''wontfix'' and move on. Silencing errors would
 do more harm than good as previous at accessing `fk_id` could have
 returned a value but then `fk` would be `None`?

 We could adjust the comment but ultimately the only way to ensure the
 retrieval of a graph of object that is coherent at query time is to use
 `select_related` to ensure all the data is retrieved a single query. From
 that time objects are not locked anyhow and the only way to ensure they
 are not altered is to use `select_for_update` and friends.

 I would argue that lazy fetching of related objects honours `READ
 COMMITED` assumption of the ORM; if you defer relationship then fetching
 at a later point in time will attempt to reconciliate your in-memory
 representation of model instances with the latest committed database state
 possibly resulting in exceptions.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28806#comment:5>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182aa10868d-7827f0ad-0595-4b3a-a514-44ccab4499ab-000000%40eu-central-1.amazonses.com.

Reply via email to