#20429: Add QuerySet.update_or_create method
-------------------------------------+-------------------------------------
Reporter: tunixman | Owner:
Type: New feature | elektrrrus
Component: Database layer | Status: assigned
(models, ORM) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by tunixman):
Race conditions are conditions that silently accept corruption, so
database constraints are the exact opposite of race conditions. They
inform the programmer that data integrity was preserved, rather than
silently corrupting it. Dealing with those exceptions at that point
properly is the right thing, because it prevents having to go through the
database much later trying to understand why there are duplicates of some
rows but not others, and why there are other more opaque exceptions (like
.get() failing), or why relations to one item are actually to several
different items. Those are race conditions, but loudly saying "I'm sorry I
can't corrupt your data for you" is not a race condition, and I strongly
think Django should be choosing the non-race-condition approach with loud
and immediate errors rather than the race-condition approach with no
errors at the time of corruption, but loud and opaque errors much later.
--
Ticket URL: <https://code.djangoproject.com/ticket/20429#comment:26>
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/066.b96237d4b7895b0833774a8342b130ff%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.