Re: [sqlalchemy] Deleting detached objects

2016-12-28 Thread Mike Bayer
Calling session.delete() is equivalent to calling session.add() first. The only downside is if the object represents state that has changed in the database elsewhere, like the row was already deleted or had a primary key change. On Dec 28, 2016 8:18 AM, "Julio César Gázquez" <

[sqlalchemy] Deleting detached objects

2016-12-28 Thread Julio César Gázquez
Hi list. I just noticed that if I retrieve an object, and close the session letting the object in detached state, then I can delete the object from the database using a new session simply issuing session.delete(), without merging it first. SQL Alchemy simply emits the DELETE and that's it,