#28674: QuerySet._batched_insert() the caller ensures, that bool(objs) is True
-------------------------------------+-------------------------------------
Reporter: Дилян | Owner: nobody
Палаузов |
Type: | Status: new
Uncategorized |
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Only QuerySet.bulk_create() calls QuerySet._batched_insert() and the
former ensures, that bool(obj-parameter) is True.
{{{
diff --git a/django/db/models/query.py b/django/db/models/query.py
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1129,10 +1129,8 @@ class QuerySet:
"""
A helper method for bulk_create() to insert the bulk one batch at
a
time. Insert recursively a batch from the front of the bulk and
then
- _batched_insert() the remaining objects again.
+ _batched_insert() the remaining objects again. bool(objs) must
be True.
"""
- if not objs:
- return
ops = connections[self.db].ops
batch_size = (batch_size or max(ops.bulk_batch_size(fields,
objs), 1))
inserted_ids = []
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28674>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/057.c6c1fe241a45181edf27162aa4b297e4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.