> > > assuming Dtable.data_id references BTable. > > There's a few ways to go about this. The usual way to alter what gets > deleted where in a flush is to use SessionExtension.before_flush() to figure > out whatever needs to happen based on the pending state of things, using > Session.delete() to mark things as deleted as needed. That way the flush > can proceed with all of its assumptions intact. This is how I would > usually do it. > > Otherwise if you want deletions of DTable to be embedded in the flush > without the flush having any awareness of it, you'd have to disable the "set > null" behavior here, which we provide via the "passive_deletes='all'" > option. If you're on 0.6 make sure you use 0.6.6 as it had a regression > previous to that. > > > Good stuff! I don't like messing around with the ordering of session operations, so I've used the passive_deleted="all" approach and it seems to work. I tried to use passive_deletes in the 0.5 series and although it worked as intended with sqlite and MyISAM tables, it gave me problems when used with InnoDB. Neat that it's working now though.
Many thanks, A. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
