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,
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()?
>
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
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
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
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.
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
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:
>
>
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
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
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
11 matches
Mail list logo