]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
dont call connection()/get_bind() all that here if we don't have to
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 13 Jun 2012 14:13:17 +0000 (10:13 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 13 Jun 2012 14:13:17 +0000 (10:13 -0400)
lib/sqlalchemy/orm/persistence.py

index 6e455d9c769e2096566536b863d806f01b2d90f5..35a12c2754d5740a341ca61cd437f430e8facedd 100644 (file)
@@ -750,13 +750,15 @@ def _connections_for_states(base_mapper, uowtransaction, states):
         connection_callable = \
                 uowtransaction.session.connection_callable
     else:
-        connection = uowtransaction.transaction.connection(
-                                                    base_mapper)
+        connection = None
         connection_callable = None
 
     for state in _sort_states(states):
         if connection_callable:
             connection = connection_callable(base_mapper, state.obj())
+        elif not connection:
+            connection = uowtransaction.transaction.connection(
+                                                    base_mapper)
 
         mapper = _state_mapper(state)