On Jul 15, 2014, at 1:27 PM, Mariano Mara <mariano.m...@gmail.com> wrote:
> Hi all > > Each time my Parent class is edited and one of the elements from its Child > relationship is removed I want to "invalidate" this element (e.g. > element.valid=False) instead of actually performing the delete DML > instruction. How can I achieve that? the foreign key has to be nullable, then you make sure "delete-orphan" cascade is not turned on, then you use a collection remove event to mark this flag as False when it is removed from the collection: http://docs.sqlalchemy.org/en/rel_0_9/orm/events.html#sqlalchemy.orm.events.AttributeEvents.remove > > I have created a "remove" event listener and I see the value to be removed > from the target but so far I have been unable to find a way to successfully > stop the delete event (I tried with EXP_STOP to no avail). just make sure delete, delete-orphan cascade are not set. It will set the foreign key column(s) to NULL. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.