I'm sure Mike or someone else has the canonical answer, but...

• `object_session(obj)` returns the session that an object is associated 
with.  
  • The Session is essentially a book-keeping layer between Python and the 
Database
  • if you `delete` an object, you merely mark it for deletion.  It is an 
object and still tracked by the session.
  • if you `flush` a session, it just emits sql and catches db errors. 
 there could still be activity done.
  • it is not until a session is `.commit()` that the object is actually 
deleted

The only thing that looks weird to me, is the 'After Expunge'.  That is not 
behaving as I would expect.

It's my understanding that `expunge` should dissociate the object from the 
session.

Does the same thing happen if you `expunge` an object that was not deleted? 
 What about one that had been committed, then loaded?  One of those 
situations would have an transient object, another would have a detached. 
 So i'm wondering if that may affect this behavior you see.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to