Michael,

Thanks for the quick response.

On Apr 5, 12:39 pm, "Michael Bayer" <[email protected]> wrote:
> you can certainly expire specific attributes by passing a list of their
> names to expire:
>
> sess.expire(inst, ['foo', 'bar', 'bat'])
>
> in modern versions of SQLAlchemy calling session.refresh(instance) should
> reload attributes in the same way that a regular query.get() does which
> would include eager relationships loaded via join.
>
Now I understand that refresh will cause a reload of all attributes
based the primary mapper. However, the reason that I want to use
expire instead of refresh is because there may be places in my code
where the same object will be expired multiple times before an
attribute is accessed, and I if I were to change all of my calls from
expire() to refresh(), then it would hit the database multiple times.

Basically, I want to know if there is a way to expire an object such
that it will reload all attributes (scalar and eagerloaded) upon the
next access.

-- 
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.

Reply via email to