summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrln <matt@cranklogic.com>2016-07-24 13:22:52 -0700
committerbrln <matt@cranklogic.com>2016-07-24 13:39:18 -0700
commit58ab1862792fa9b981f32f74356e421d57995f0b (patch)
treeb72ce8326885c9acd3ed28a0a0d257843280e43b
parent8952a30f0a27d6b57e7b054b8b464382b67e3828 (diff)
downloadsqlalchemy-pr/294.tar.gz
Bulk Save Documentationpr/294
The session::bulk_save_objects method emphasizes performance, but generates many insert statements when a variety of object types are passed in an unordered list. This was a signification gotcha for me, and seems contrary to the spirit of the method, so short of changing the method to automatically sort the list, it should at least be documented.
-rw-r--r--lib/sqlalchemy/orm/session.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py
index a7440bf40..a7eedcf34 100644
--- a/lib/sqlalchemy/orm/session.py
+++ b/lib/sqlalchemy/orm/session.py
@@ -2213,6 +2213,12 @@ class Session(_SessionClassMethods):
**before using this method, and fully test and confirm the
functionality of all code developed using these systems.**
+ .. warning::
+
+ Objects are processed in the order passed. Be sure to group objects
+ of the same type together (the list is sorted), else they will be
+ inserted in distinct batches.
+
:param objects: a list of mapped object instances. The mapped
objects are persisted as is, and are **not** associated with the
:class:`.Session` afterwards.