Hi,
I recently upgraded my system from SA 0.3.11 to 0.5.8, and I found
that the behaviour for expiring instances has changed in terms of how
much data gets retrieved upon attribute access. For instance,
# One User can have many groups
mapper(User, user_tbl, properties={'groups':relation(Group, ...,
lazy=False, ...)})
user_inst = session.query(User).first()
session.expire(user_inst)
# name is a scalar attribute
# SA 0.3.11 will also eagerload User.groups relation, SA 0.5.8 will
only reload scalar attributes
user_inst.name
# SA 0.3.11 will not hit the db, SA 0.5.8 will hit the db
user_inst.groups
AFAICT, expiring user_inst in SA 0.3.11 would create an instance-wide
trigger so that the next attribute access would refresh the entire
instance based on its primary mapper. However, in SA 0.5.8 (introduced
in 0.4.1?) the functionality to expire specific attributes and this
behaviour no longer exists. According to the docs, eager relationships
should all be repopulated after an expired instance's attribute has
been accessed, but this seems to be no longer the case. Is there any
way I can recreate this behaviour?
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.