If you put a refresh just before your assert, that is working: ... user = session.query(User).selectone_by(name='user1') session.refresh(user) # here ! assert user.post_count==2, 'user.post_count is %s'%user.post_count
Not sure to understand why though... I bet its because of SA's cache (identity_map). Since the user was already loaded before, SA doesn't re-perform sql access to the db. You can see it by activating engine.echo = True, and selecting users by id (eg. session.query(User).get(1)) Hope it helps. Cheers, Seb -- Sébastien LELONG sebastien.lelong[at]sirloon.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---