On Jun 30, 2008, at 4:37 AM, Tai Tran wrote:

>    # Create a new Foo object, then save it to the database
>    db_session = Session()
>    f = Foo('001')
>    db_session.save(f)
>    db_session.commit()
>
>    # Try deleting Foo object created above with a new, different
> session
>    db_session2 = Session()
>    f1 = db_session2.get(Foo, f.id)
>    print 'f =', f
>    print 'f1 =', f1
>    print 'f1 is f =', f1 is f
>    db_session2.delete(f)
>

"f" is still attached to db_session.  if you want to delete "f1", say  
db_session2.delete(f1).  Or if "f", say db_session.delete(f).   if you  
want to move objects between sessions, use session.expunge()/ 
session.save_or_update().



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to