Previously Michael Bayer wrote:
> 
> 
> On Feb 26, 2009, at 1:29 AM, 一首诗 wrote:
> 
> >
> > The document says:
> >
> > ====================================================
> > Expunge removes an object from the Session, sending persistent
> > instances to the detached state, and pending instances to the
> > transient state:
> >
> > ====================================================
> >
> > I hoped that if an instance was expunged from a session, I might use
> > it safely as a container of some temp data without fearing trigger any
> > database query.
> >
> > But I found that if an object is 'expunge'd ,  it's properties will
> > not be accessible anymore.
> >
> > So, when should we use expunge?  Or it is kept for sqlalchemy inner
> > use only?
> 
> you can reattach the object to a session later if you need it to be  
> part of a transaction again.    it can be used for caching scenarios,  
> for example.  But I agree most reasonable applications probably won't  
> use expunge() very much.

What happens if you do not call expunge on it, but pickle the object in a
cache, load it later and then merge it? 

Wichert.

-- 
Wichert Akkerman <wich...@wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.

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