Wouldn't a manual transaction (suitably rolled back after a bunch of changes) retain atomicity as well?
The proposed solution using the UPDATE ....FROM from_list ... syntax and based on the postgres documentation link (below) does not seem to be any inferior to doing a single UPDATE XYZ SET A = 1, so it makes a valid candidate for the ORM to expose it to applications which require the same. http://www.postgresql.org/docs/9.3/static/sql-update.html On 20 October 2014 12:06, Alex Gaynor <[email protected]> wrote: > No, it doesn't. The atomicity semantics of update() are impossible to > implement without it, this isn't the case for a multi-object UPDATE as far > as I can tell. > > Alex > > On Sun, Oct 19, 2014 at 11:34 PM, Anshuman Aggarwal < > [email protected]> wrote: > >> Thanks for the input Javier. Wouldn't a similar argument hold for: >> >> UPDATE books_book >> >> SET >> >> price = 10 where pk = 1, price = 25 where pk = 2 ..... >> >> Such a single SQL statement would also have similar benefits to having >> much less data to prepare, send and interpret vs having multiple update >> queries being collated into a single transaction. >> >> On 20 October 2014 11:52, Javier Guerra Giraldez <[email protected]> >> wrote: >> >>> On Mon, Oct 20, 2014 at 1:03 AM, Anshuman Aggarwal >>> <[email protected]> wrote: >>> > The idea of having a .update() ORM construct is to be able to do this >>> > without having to fall down to a manual transaction every time, >>> otherwise >>> > why have a DB level <qs>.update()...I am sure the performance of above >>> > pseudo code would be about the same (or sufficiently small as to be >>> > ignorable)... >>> >>> >>> i'm sure it's far from ignorable. <qs>.update() generates an UPDATE >>> ... WHERE ... statement, not specifying each record to be updated, >>> just the criteria to let the DB engine choose them. Also, the new >>> field content is either a constant or specified as a function of other >>> fields (when using F() objects); again, not specified individually, >>> but let to the DB engine to work it out. >>> >>> in sum, it's a _lot_ less data to prepare, send, and interpret and >>> uses a heavily optimized, totally SQL statement. Not having it would >>> be a big missing feature. >>> >>> -- >>> Javier >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Django developers (Contributions to Django itself)" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/django-developers/Hcsh4r9_mHg/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/django-developers. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-developers/CAFkDaoQi3z62emT4Dk1hAvpM5sSUshbFSoOqumA0kZymLURO9A%40mail.gmail.com >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django developers (Contributions to Django itself)" 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]. >> Visit this group at http://groups.google.com/group/django-developers. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-developers/CAK-d5daWgeOOBAOgTg9nWRhQnk%3DB_TvhpRTLPy2Sr-AqsiOxng%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-developers/CAK-d5daWgeOOBAOgTg9nWRhQnk%3DB_TvhpRTLPy2Sr-AqsiOxng%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > "I disapprove of what you say, but I will defend to the death your right > to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) > "The people's good is the highest law." -- Cicero > GPG Key fingerprint: 125F 5C67 DFE9 4084 > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django developers (Contributions to Django itself)" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-developers/Hcsh4r9_mHg/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/CAFRnB2XvKC_oHKymGg5J05kQF9RgSmp0hWPVgpU6%2BbmiNZ-W%2BQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-developers/CAFRnB2XvKC_oHKymGg5J05kQF9RgSmp0hWPVgpU6%2BbmiNZ-W%2BQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" 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]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAK-d5dYZjeGnDZh%3D2KEecC4aF9Qagragtk%3DrtU_ksZXVMz%3D%3D%3Dg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
