Thanks - I'll see how far the "expire_on_commit=False" takes me.

On 5 Feb., 16:11, Michael Bayer <mike...@zzzcomputing.com> wrote:
> On Feb 5, 2009, at 9:04 AM, pwaern wrote:
>
> > What I would like to be able to is to keep on working with detached
> > objects like the user object in the code above , in a manner where the
> > objects attribute values are the same as they were when the session
> > was closed, i.e. without further database queries (and certainly
> > without exceptions!). If there was some way to ensure that all
> > database attributes on the object were loaded but not modifiable, it
> > could solve the problem. In my current application I use the
> > get_session extension to return the ScopedSession instance in order to
> > ensure that I can access attributes but I would prefer that the
> > objects were properly detached but still funcionable.
>
> you'd have to call refresh() or otherwise hit an attribute on every  
> object before detached from a session.    Alternatively, you could set  
> expire_on_commit=False on your sessionmaker() so that the commit()  
> operation leaves the current in-memory state in place.   The latter  
> option would be why your test program works in 0.4, there wasnt any  
> expire_on_commit behavior.
>
> .
--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to