diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-06-13 20:15:17 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-06-13 20:15:17 -0400 |
commit | 2497d559ddeb68e52eb1838deeed7e3305280aa5 (patch) | |
tree | b59536be2df082b9f16988aaaa3126c981148358 | |
parent | 09485d733131b667813f44eb0b6807b698668ee7 (diff) | |
download | sqlalchemy-2497d559ddeb68e52eb1838deeed7e3305280aa5.tar.gz |
- add changelog for #3451, with 09485d733131b667813f44eb0b6807b698668ee7 fixes #3451
- also add a bulk_insert_mappings test
-rw-r--r-- | doc/build/changelog/changelog_10.rst | 10 | ||||
-rw-r--r-- | test/aaa_profiling/test_memusage.py | 3 | ||||
-rw-r--r-- | test/orm/test_bulk.py | 21 |
3 files changed, 33 insertions, 1 deletions
diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index f44886559..e37fc46c7 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -20,6 +20,16 @@ .. 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 Fixed an unexpected-use regression whereby custom :class:`.Comparator` diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py index 63883daac..a777a8aa1 100644 --- a/test/aaa_profiling/test_memusage.py +++ b/test/aaa_profiling/test_memusage.py @@ -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: diff --git a/test/orm/test_bulk.py b/test/orm/test_bulk.py index 1e0a735c7..e2a1464a6 100644 --- a/test/orm/test_bulk.py +++ b/test/orm/test_bulk.py @@ -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 |