summaryrefslogtreecommitdiff
path: root/test/orm
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-08-14 20:47:49 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-08-14 20:47:49 -0400
commitbc509dd50d7b65e35412e2be67bd37a6c19e7119 (patch)
tree47550a3b782e691dd6632eeb2eae575d00376f09 /test/orm
parentf0a56bc5aa8cb0ca7b642eaa99093ade2065d4b5 (diff)
downloadsqlalchemy-bc509dd50d7b65e35412e2be67bd37a6c19e7119.tar.gz
- UPDATE statements can now be batched within an ORM flush
into more performant executemany() call, similarly to how INSERT statements can be batched; this will be invoked within flush to the degree that subsequent UPDATE statements for the same mapping and table involve the identical columns within the VALUES clause, as well as that no VALUES-level SQL expressions are embedded. - some other inlinings within persistence.py
Diffstat (limited to 'test/orm')
-rw-r--r--test/orm/test_unitofwork.py9
-rw-r--r--test/orm/test_unitofworkv2.py31
2 files changed, 18 insertions, 22 deletions
diff --git a/test/orm/test_unitofwork.py b/test/orm/test_unitofwork.py
index 6eb763213..a54097b03 100644
--- a/test/orm/test_unitofwork.py
+++ b/test/orm/test_unitofwork.py
@@ -1126,11 +1126,12 @@ class OneToManyTest(_fixtures.FixtureTest):
("UPDATE addresses SET user_id=:user_id "
"WHERE addresses.id = :addresses_id",
- {'user_id': None, 'addresses_id': a1.id}),
+ [
+ {'user_id': None, 'addresses_id': a1.id},
+ {'user_id': u1.id, 'addresses_id': a3.id}
+ ]),
- ("UPDATE addresses SET user_id=:user_id "
- "WHERE addresses.id = :addresses_id",
- {'user_id': u1.id, 'addresses_id': a3.id})])
+ ])
def test_child_move(self):
"""Moving a child from one parent to another, with a delete.
diff --git a/test/orm/test_unitofworkv2.py b/test/orm/test_unitofworkv2.py
index 9c9296786..c643e6a87 100644
--- a/test/orm/test_unitofworkv2.py
+++ b/test/orm/test_unitofworkv2.py
@@ -131,12 +131,10 @@ class RudimentaryFlushTest(UOWTest):
CompiledSQL(
"UPDATE addresses SET user_id=:user_id WHERE "
"addresses.id = :addresses_id",
- lambda ctx: [{'addresses_id': a1.id, 'user_id': None}]
- ),
- CompiledSQL(
- "UPDATE addresses SET user_id=:user_id WHERE "
- "addresses.id = :addresses_id",
- lambda ctx: [{'addresses_id': a2.id, 'user_id': None}]
+ lambda ctx: [
+ {'addresses_id': a1.id, 'user_id': None},
+ {'addresses_id': a2.id, 'user_id': None}
+ ]
),
CompiledSQL(
"DELETE FROM users WHERE users.id = :id",
@@ -240,12 +238,10 @@ class RudimentaryFlushTest(UOWTest):
CompiledSQL(
"UPDATE addresses SET user_id=:user_id WHERE "
"addresses.id = :addresses_id",
- lambda ctx: [{'addresses_id': a1.id, 'user_id': None}]
- ),
- CompiledSQL(
- "UPDATE addresses SET user_id=:user_id WHERE "
- "addresses.id = :addresses_id",
- lambda ctx: [{'addresses_id': a2.id, 'user_id': None}]
+ lambda ctx: [
+ {'addresses_id': a1.id, 'user_id': None},
+ {'addresses_id': a2.id, 'user_id': None}
+ ]
),
CompiledSQL(
"DELETE FROM users WHERE users.id = :id",
@@ -732,12 +728,11 @@ class SingleCycleTest(UOWTest):
testing.db, sess.flush, AllOf(
CompiledSQL(
"UPDATE nodes SET parent_id=:parent_id "
- "WHERE nodes.id = :nodes_id", lambda ctx: {
- 'nodes_id': n3.id, 'parent_id': None}),
- CompiledSQL(
- "UPDATE nodes SET parent_id=:parent_id "
- "WHERE nodes.id = :nodes_id", lambda ctx: {
- 'nodes_id': n2.id, 'parent_id': None}),
+ "WHERE nodes.id = :nodes_id", lambda ctx: [
+ {'nodes_id': n3.id, 'parent_id': None},
+ {'nodes_id': n2.id, 'parent_id': None}
+ ]
+ )
),
CompiledSQL(
"DELETE FROM nodes WHERE nodes.id = :id", lambda ctx: {