From 68560ff2c53dab8d6bbc48a89694edfe26765ad8 Mon Sep 17 00:00:00 2001 From: Jophy Chon Hou Ye <44258870+jophy-ye@users.noreply.github.com> Date: Thu, 6 Feb 2025 20:35:07 -0500 Subject: [PATCH 1/2] Add atomic note for `bulk_create`, `bulk_update --- docs/ref/models/querysets.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 8bf83838c0..1cf4af1926 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -2418,7 +2418,7 @@ are), and returns created objects as a list, in the same order as provided: ... ] ... ) -This has a number of caveats though: +This method is atomic, i.e., all batches of creation succeed or none. This has a number of caveats though: * The model's ``save()`` method will not be called, and the ``pre_save`` and ``post_save`` signals will not be sent. @@ -2495,6 +2495,7 @@ updated: >>> Entry.objects.bulk_update(objs, ["headline"]) 2 +This method is atomic, i.e., all batches of creation succeed or none. :meth:`.QuerySet.update` is used to save the changes, so this is more efficient than iterating through the list of models and calling ``save()`` on each of them, but it has a few caveats: From 3f674121b13e473f6c7593cd7b471c3f55fcc72b Mon Sep 17 00:00:00 2001 From: Jophy Chon Hou Ye <44258870+jophy-ye@users.noreply.github.com> Date: Thu, 6 Feb 2025 20:44:24 -0500 Subject: [PATCH 2/2] Updated typo --- docs/ref/models/querysets.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 1cf4af1926..b718c9e230 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -2495,7 +2495,7 @@ updated: >>> Entry.objects.bulk_update(objs, ["headline"]) 2 -This method is atomic, i.e., all batches of creation succeed or none. +This method is atomic, i.e., all batches of updates succeed or none. :meth:`.QuerySet.update` is used to save the changes, so this is more efficient than iterating through the list of models and calling ``save()`` on each of them, but it has a few caveats: