cursor.rowcount at all, a warning is emitted the same
as with saves. [ticket:1761]
+ - The ORM now short-term caches the "compiled" form of
+ insert() and update() constructs when flushing lists of
+ objects of all the same class, thereby avoiding redundant
+ compilation per individual INSERT/UPDATE within an
+ individual flush() call.
+
- internal getattr(), setattr(), getcommitted() methods
on ColumnProperty, CompositeProperty, RelationshipProperty
have been underscored, signature has changed.
update.append((state, state_dict, params, mapper,
connection, value_params))
+
if update:
mapper = table_to_mapper[table]
clause = sql.and_()
statement = table.update(clause)
+ if len(update) > 1:
+ compiled_cache = {}
+ else:
+ compiled_cache = None
+
rows = 0
for state, state_dict, params, mapper, connection, value_params in update:
- c = connection.execute(statement.values(value_params), params)
+ if not value_params and compiled_cache is not None:
+ c = connection.\
+ execution_options(
+ compiled_cache=compiled_cache).\
+ execute(statement, params)
+ else:
+ c = connection.execute(statement.values(value_params), params)
+
mapper._postfetch(uowtransaction, table,
state, state_dict, c, c.last_updated_params(), value_params)
if insert:
statement = table.insert()
+ if len(insert) > 1:
+ compiled_cache = {}
+ else:
+ compiled_cache = None
+
for state, state_dict, params, mapper, connection, value_params in insert:
- c = connection.execute(statement.values(value_params), params)
+ if not value_params and compiled_cache is not None:
+ c = connection.\
+ execution_options(
+ compiled_cache=compiled_cache).\
+ execute(statement, params)
+ else:
+ c = connection.execute(statement.values(value_params), params)
primary_key = c.inserted_primary_key
if primary_key is not None: