.. changelog::
:version: 1.0.6
+ .. change::
+ :tags: bug, orm
+ :tickets: 3451
+ :pullreq: github:181
+
+ Fixed bug in new :meth:`.Session.bulk_update_mappings` feature where
+ the primary key columns used in the WHERE clause to locate the row
+ would also be included in the SET clause, setting their value to
+ themselves unnecessarily. Pull request courtesy Patrick Hayes.
+
.. change::
:tags: bug, orm
:tickets: 3448
# tests under 50 iterations and ideally about ten, so
# just filter them out so that we get a "flatline" more quickly.
- if testing.against("sqlite+pysqlite"):
+ if testing.against("sqlite+pysqlite") or \
+ testing.against("sqlite+pysqlcipher"):
return [o for o in gc.get_objects()
if not isinstance(o, weakref.ref)]
else:
)
)
+ def test_bulk_insert(self):
+ User, = self.classes("User",)
+
+ s = Session()
+ with self.sql_execution_asserter() as asserter:
+ s.bulk_insert_mappings(
+ User,
+ [{'id': 1, 'name': 'u1new'},
+ {'id': 2, 'name': 'u2'},
+ {'id': 3, 'name': 'u3new'}]
+ )
+
+ asserter.assert_(
+ CompiledSQL(
+ "INSERT INTO users (id, name) VALUES (:id, :name)",
+ [{'id': 1, 'name': 'u1new'},
+ {'id': 2, 'name': 'u2'},
+ {'id': 3, 'name': 'u3new'}]
+ )
+ )
+
class BulkInheritanceTest(BulkTest, fixtures.MappedTest):
@classmethod