Commits

Scott Torborg  committed 2ed4f7d Draft

added test of synchronize_session='fetch' on rows which are not already in the session, and patch to fix failure

  • Participants
  • Parent commits acbaeb1

Comments (0)

Files changed (2)

File lib/sqlalchemy/orm/persistence.py

                                                         list(primary_key))
                 for primary_key in self.matched_rows
             ]
+            if identity_key in session.identity_map
         ])
         attrib = [_attr_as_key(k) for k in self.values]
         for state in states:

File test/orm/test_update_delete.py

         eq_([john.age, jack.age, jill.age, jane.age], [25,37,29,27])
         eq_(sess.query(User.age).order_by(User.id).all(), zip([25,37,29,27]))
 
+    def test_update_without_load(self):
+        User = self.classes.User
+
+        sess = Session()
+
+        sess.query(User).filter(User.id == 3).\
+                update({'age': 44}, synchronize_session='fetch')
+        eq_(sess.query(User.age).order_by(User.id).all(), zip([25,37,44,27]))
+
     def test_update_changes_resets_dirty(self):
         User = self.classes.User