Changes between Initial Version and Version 1 of Ticket #28806, comment 5
- Timestamp:
- Aug 16, 2022, 11:32:42 PM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #28806, comment 5
initial v1 1 1 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`? 2 2 3 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.3 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 though but the graph is coherent. It could still result in exception at attempt to reconciliate in memory representation (e.g. `save(force_update)` but the only sane way to prevent that is to use `select_for_update` and friends, no level or ORM magic will be able to always do the right thing here. 4 4 5 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 .5 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 as we should avoid the temptation to guess and be very explicit about reconciliation failures.