#28344: Add `for_update=False` to `refresh_from_db()`
-------------------------------------+-------------------------------------
               Reporter:  Patryk     |          Owner:  nobody
  Zawadzki                           |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Database   |        Version:  1.11
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 I have a project where we deal with many financial operations that rely on
 transactions and row-level locking a lot to guard against race conditions.
 Unfortunately it's a common pattern for a function to accept an instance
 of model A, start an atomic block, fetch a new instance of the same row
 with `select_for_update()`, do a change, call `save()` and then refresh
 the original instance. It would all be easier if I could just call
 `instance.refresh_from_db(for_update=True)` and it would save a me a DB
 roundtrip to refresh the original instance passed (Django ORM does not
 have a session manager so the old object will not otherwise reflect the
 changes).

--
Ticket URL: <https://code.djangoproject.com/ticket/28344>
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/049.d6dc498645b3c2336cfc01bfb0db8733%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to