Re: bulk_update() support for unique fields instead of only primary key

2022-06-19 Thread Ebram Shehata
Ah, I see. Thank you for explaining the thing and linking the code. It looks more interesting now! I'm interested to start working on it. I'll wait for approval from other people, too. On Wednesday, June 8, 2022 at 2:17:32 PM UTC+2 j.bre...@netzkolchose.de wrote: > > > How can it be complicated

Re: bulk_update() support for unique fields instead of only primary key

2022-06-08 Thread Jörg Breitbart
How can it be complicated ? I thought it's just something like getattr(MyModel, field_name) to get value and model._meta.get_field(unique_field) to get the field instance.. Where can I find explanation for what you mean? and where can I find the PK code you're referring to? Field updates fo

Re: bulk_update() support for unique fields instead of only primary key

2022-06-07 Thread Ebram Shehata
Thank you for your reply. > Implementation might get complicated in multi table > inheritance, where the unqiue field may not reside on the target table > itself (would need a similar tables+rows lookup expansion as done for pk). How can it be complicated ? I thought it's just something like ge

Re: bulk_update() support for unique fields instead of only primary key

2022-06-06 Thread Jörg Breitbart
Imho the pk field being treated special by bulk_update (as the only record filter predicate, non updatable) comes from one simple idea - stable object identity during the updates. For an ORM proper object identification is rather important to not mix things up, shifting identities might create

bulk_update() support for unique fields instead of only primary key

2022-06-06 Thread Ebram Shehata
I've already created a ticket that ended up with 'WONTFIX' here . Please read it first. The scenario that led me trying to add that feature: Well, I'v a model that has a primary key and unique field... Every X period of time I've a cron that calls an