On Thursday, October 18, 2012 11:43:50 AM UTC-4, Michael Bayer wrote: > > > On Oct 17, 2012, at 9:55 PM, Kent wrote: > > > The attached script fails with "sqlalchemy.exc.InvalidRequestError: > Instance '<Bug at 0x1e6f3d10>' has been deleted. Use the make_transient() > function to send this object back to the transient state." > > > > While this example is somewhat convoluted, I have a few questions about > sqlalchemy behavior here: > > > > 1) At the session.flush(), even though the Rock and the bugs > relationship have been expunged, the pending delete still is issued to the > database. Would you expect/intend sqlalchemy to delete even after the > expunge()? > > no, because the Rock you have merged has established that the Bug is no > longer associated with it. You expunge the Rock, there's no Bug attached > to it to be expunged. > > I am still slightly unclear on this: since sqlalchemy *does *delete the Bug, I assume it is "marked for deletion" in some way when the 'bugs' relationship is merged to the empty list []. Is that accurate? Please help me understand why it does not show up in session.deleted, which is IdentitySet([])?
-- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/pnnq3lOodtYJ. 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.