diff options
| author | Tom <tom@tomforb.es> | 2017-10-03 00:35:38 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-08-03 17:40:46 -0400 |
| commit | f1fbef6cd171ddfae41fcc901f1f60ccad039f51 (patch) | |
| tree | 414e5d00478371dd01e0bf69467cc32301260cb5 /docs/ref | |
| parent | 45086c294d63ac8787cebff2accd1680ac844138 (diff) | |
Fixed #28668 -- Allowed QuerySet.bulk_create() to ignore insert conflicts.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/querysets.txt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 57db085c5f..c171d5074f 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -2039,7 +2039,7 @@ exists in the database, an :exc:`~django.db.IntegrityError` is raised. ``bulk_create()`` ~~~~~~~~~~~~~~~~~ -.. method:: bulk_create(objs, batch_size=None) +.. method:: bulk_create(objs, batch_size=None, ignore_conflicts=False) This method inserts the provided list of objects into the database in an efficient manner (generally only 1 query, no matter how many objects there @@ -2079,6 +2079,16 @@ The ``batch_size`` parameter controls how many objects are created in a single query. The default is to create all objects in one batch, except for SQLite where the default is such that at most 999 variables per query are used. +On databases that support it (all except PostgreSQL < 9.5 and Oracle), setting +the ``ignore_conflicts`` parameter to ``True`` tells the database to ignore +failure to insert any rows that fail constraints such as duplicate unique +values. Enabling this parameter disables setting the primary key on each model +instance (if the database normally supports it). + +.. versionchanged:: 2.2 + + The ``ignore_conflicts`` parameter was added. + ``count()`` ~~~~~~~~~~~ |
