John Huang wrote:
>>
> 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.

Not currently.  The mechanics of triggering a relationship() reload are
more complex than that of the mechanics of an individual attribute reload.
 Its a one line change to have the "unexpire" callable include
relationships in it's load, which works for a simplistic eagerload case. 
But since most of those are lazyloads, the attribute accounting is not
currently smart enough to reconcile all of it, and many tests fail.   The
expiration accounting in 0.3 was much more primitive as expiration was not
a common event in that version.



>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to