Closed jerch closed 2 years ago
Obsolete now, as we cannot solve it without a reliable batching/duplicates plan. Resorting expression updates would always lead to update edge cases not properly covered without strict duplicate handling. (Linked to #11).
To get feature parity,
fast_update
should get support for expression values.We might get away by simply prefiltering objects with expression values and update them with
bulk_update
beforehand. This should be equivalent for dbs with standard UPDATE implementation, which normally does not allow window functions directly. This needs some serious tests against mysql (non-standard UPDATE impl), and CTE/subquery windowing tricks (updatable views - not sure if those can be expressed by django ORM at all).Plan B would be to apply the same CASE chain idea to the SET clause as
bulk_update
but only for fields with expression values, The chains also would be much shorter, given that most values are literal values from the values table. Yet the creation of those chains is cumbersome, also the runtime will suffer again, so thats only the second best option.