]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add changelog for #3451, with 09485d733131b667813f44eb0b6807b698668ee7 fixes #3451
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 14 Jun 2015 00:15:17 +0000 (20:15 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 14 Jun 2015 00:15:17 +0000 (20:15 -0400)
- also add a bulk_insert_mappings test

doc/build/changelog/changelog_10.rst
test/aaa_profiling/test_memusage.py
test/orm/test_bulk.py

index f448865591a997a8c66ab7875f1efd4752b4747b..e37fc46c79fc9feeacaf9367b28bbbe4759dc8e4 100644 (file)
 .. 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
index 63883daac6bb785a5588ea1981a1767e34668b3c..a777a8aa1dc39577a5b78d40d294889147f96208 100644 (file)
@@ -45,7 +45,8 @@ def profile_memory(maxtimes=50):
             # 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:
index 1e0a735c7616bbb53d2c44c1527c7789880b2984..e2a1464a61330c4377a9ddda1c67cccf043fc867 100644 (file)
@@ -134,6 +134,27 @@ class BulkInsertUpdateTest(BulkTest, _fixtures.FixtureTest):
             )
         )
 
+    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