it would only do that if you have delete-orphan on the relation, and the object was never saved. it will get re-added once you attach it to something again. im not sure at what point we added that behavior, its so that delete-orphan in conjunction with collection.remove() works in all cases, even if the element was never saved.
Alessandro Dentella wrote: > > Hi, > > in the following code new_film is added to a director film list and then > removed, before committing. > > I just realized that this makes it vanish from the session. What's the > rationale behind it? I fear I don't understand something becouse I would > have thought it should stay in the session. > > >>> donn = sess.query(Director).filter_by(last_name='Donnersmak').one() > >>> new_film = Movie() > >>> sess.add(new_film) > >>> donn.movies += [new_film] > >>> donn.movies.remove(new_film) > >>> print new_film in sess > False > > thanks in advance > > sandro > *:-) > > -- > Sandro Dentella *:-) > http://sqlkit.argolinux.org SQLkit home page - > PyGTK/python/sqlalchemy > > > > --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---