orm icon indicating copy to clipboard operation
orm copied to clipboard

add support for bulk_update

Open Mng-dev-ai opened this issue 3 years ago • 8 comments

Mng-dev-ai avatar Jan 11 '22 09:01 Mng-dev-ai

I have to admit I'm not sure how the API should look like. I'll probably take a look at a few examples in other projects. Maybe you can update the PR to show the current signature of the bulk update.

aminalaee avatar Jan 13 '22 15:01 aminalaee

https://github.com/collerek/ormar/blob/1ffb28d7b06f3f7989a6219c900e2fd441cbea42/ormar/queryset/queryset.py#L1064 I think that ormar do the same thing here. Anyway take your time and ping me if you have any updates.

Mng-dev-ai avatar Jan 13 '22 20:01 Mng-dev-ai

It is also standard bulk update as Django: https://docs.djangoproject.com/en/4.0/ref/models/querysets/#bulk-update

aminalaee avatar Feb 02 '22 13:02 aminalaee

TBH I think this is really good and useful but as long as the databases project is not doing the bulk actions it's confusing and misleading to have bulk actions here. But for the record, the databases doesn't do bulk insert/update and will insert these one by one so there won't be any difference.

We can keep it until then.

aminalaee avatar Feb 22 '22 09:02 aminalaee

So, maybe we need to add it to databases first.

Mng-dev-ai avatar Feb 22 '22 10:02 Mng-dev-ai

yes, I have an old PR which is doing it but It's not really the best way but it can give you some ideas. Feel free to take a look at that and start your own.

aminalaee avatar Feb 22 '22 10:02 aminalaee

Yeah sure, I will take a look at it.

Mng-dev-ai avatar Feb 22 '22 10:02 Mng-dev-ai

Check https://github.com/encode/databases/pull/468#issue-1147100109

Mng-dev-ai avatar Feb 22 '22 16:02 Mng-dev-ai