10:54 PM
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: Cannot delete persisted object which is not in
current session
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
King Simon wrote:
The 'object_session' function returns the session that an object is
currently associated with. I would have thought that you could write
your destroySelf method as:
def destroySelf(self):
db_session = object_session(self)
db_session.delete(self)
I have tried using
I'm using SQLAlchemy 0.4.6 with Python 2.5.2, and having a problem
with deleting object. Below is the testing code that shows my problem:
from sqlalchemy import *
from sqlalchemy.orm import *
engine = create_engine('sqlite:///C:/test_db.sqlite')
Session = sessionmaker(bind=engine,