Re: Adding a bulk_save method to models

2018-09-16 Thread Tom Forbes
Thank you all for the feedback, I’ve changed the method to be bulk_update() as this seems to be the most liked option. Naming things is hard, and while bulk_update() isn’t perfect I think it’s a bit better than bulk_update_fields() or just update_fields(). On 16 September 2018 at 10:19:40,

Re: Adding a bulk_save method to models

2018-09-16 Thread Tobias Kunze
On 18-09-15 23:15:10, Adam Johnson wrote: >> I agree bulk_save() maybe is not the best name as people might expect >> signals to be sent, but are there any suggestions other than bulk_update()? >> Maybe something more accurate, like bulk_update_fields()? Or >> bulk_save_fields()? >

Re: Adding a bulk_save method to models

2018-09-15 Thread charettes
I also dislike bulk_save() for the same reasons. I feel like bulk_update makes the most of sense given it has a signature similar to bulk_create where an iterable of model instances must be passed we're really just performing an update. To the bulk_update and update is the natural analogous to

Re: Adding a bulk_save method to models

2018-09-15 Thread Adam Johnson
Bikeshed time. I'm also against bulk_save for the same reason that it implies save(). bulk_update sounds okay to me, update() is indeed already a 'bulk' operation but it could be claimed this is doing a 'bulk' amount of update operations. bulk_update_fields also sounds good, the longer method

Re: Adding a bulk_save method to models

2018-09-15 Thread Tom Forbes
My original reasoning was that Queryset.update() already bulk updates rows, so the bulk prefix seems a bit redundant here (how do you bulk something that already does something in bulk?). .save() however operates on a single object, so the bulk prefix seems more appropriate and easier to

Re: Adding a bulk_save method to models

2018-09-14 Thread Raphael Michel
Hi, I'd be very careful about calling it bulk_save(), since calling it something with save() very strongly suggests that it calls pre_save or post_save signals. Best Raphael Am Fri, 14 Sep 2018 07:56:38 -0700 (PDT) schrieb Tim Graham : > > > I wanted to ask about naming of the new method.

Re: Adding a bulk_save method to models

2018-09-14 Thread Tim Graham
I wanted to ask about naming of the new method. Currently the proposed name is "QuerySet.bulk_save()" but I think it's a bit confusing since it uses QuerySet.update(), not Model.save(). It works similarly to QuerySet.bulk_update() from https://github.com/aykut/django-bulk-update but the

Re: Adding a bulk_save method to models

2018-01-23 Thread Neal Todd
Hi Tom, That's great, should be a helpful addition to core. Will follow the ticket and PR. Neal (Apologies - I hadn't spotted that you'd already referenced django-bulk-update in your ticket when I left my drive-by comment!) On Monday, January 22, 2018 at 7:41:11 PM UTC, Tom Forbes wrote: > >

Re: Adding a bulk_save method to models

2018-01-22 Thread Tom Forbes
Hey Neal, Thank you very much for pointing that out, I actually found out about this package as I was researching the ticket - I wish I had known about this a couple of years ago as it would have saved me a fair bit of CPU and brain time! I think that module is a good starting point and proves

Re: Adding a bulk_save method to models

2018-01-22 Thread Neal Todd
Hi Tom, A built-in bulk save that's more flexible than update would certainly be nice. Just in case you haven't come across it though, there is a package called django-bulk-update: https://github.com/aykut/django-bulk-update I've found it very useful on a number of occassions where update

Adding a bulk_save method to models

2018-01-19 Thread Tom Forbes
Hello all, I’d love for some feedback on an idea I’ve been mulling around lately, namely adding a bulk_save method to Dango. A somewhat common pattern for some applications is to loop over a list of models, set an attribute and call save on them. This unfortunately can issue a lot of database