From d39927ec20dd0b66f4ab3aab3e4e67b3814186ce Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 18 Aug 2014 12:50:29 -0400 Subject: - major simplification of _collect_update_commands. in particular, we only call upon the history API fully for primary key columns. We also now skip the whole step of looking at PK columns and using any history at all if no net changes are detected on the object. --- test/orm/test_dynamic.py | 10 +++++----- test/orm/test_unitofworkv2.py | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'test/orm') diff --git a/test/orm/test_dynamic.py b/test/orm/test_dynamic.py index bc47ba3f3..950ff1953 100644 --- a/test/orm/test_dynamic.py +++ b/test/orm/test_dynamic.py @@ -509,10 +509,6 @@ class UOWTest( self.assert_sql_execution( testing.db, sess.flush, - CompiledSQL( - "SELECT users.id AS users_id, users.name AS users_name " - "FROM users WHERE users.id = :param_1", - lambda ctx: [{"param_1": u1_id}]), CompiledSQL( "SELECT addresses.id AS addresses_id, addresses.email_address " "AS addresses_email_address FROM addresses " @@ -523,7 +519,11 @@ class UOWTest( "UPDATE addresses SET user_id=:user_id WHERE addresses.id = " ":addresses_id", lambda ctx: [{'addresses_id': a2_id, 'user_id': None}] - ) + ), + CompiledSQL( + "SELECT users.id AS users_id, users.name AS users_name " + "FROM users WHERE users.id = :param_1", + lambda ctx: [{"param_1": u1_id}]), ) def test_rollback(self): diff --git a/test/orm/test_unitofworkv2.py b/test/orm/test_unitofworkv2.py index 122fe2514..374a77237 100644 --- a/test/orm/test_unitofworkv2.py +++ b/test/orm/test_unitofworkv2.py @@ -1277,6 +1277,8 @@ class RowswitchAccountingTest(fixtures.MappedTest): old = attributes.get_history(p3, 'child')[2][0] assert old in sess + # essentially no SQL should emit here, + # because we've replaced the row with another identical one sess.flush() assert p3.child._sa_instance_state.session_id == sess.hash_key -- cgit v1.2.1