Michael Bayer wrote: > > On Jun 30, 6:54 am, Huy Do <[EMAIL PROTECTED]> wrote: > >> This is my problem. I have cascade delete on one of my tables, and when >> i try to delete a record, i get the null not allowed in foreign key >> error. This happens because SA is trying to update my child records when >> i delete the main record. I was hoping to use >> Relation(...cascade="expunge"), >> > > use relation(cascade="all, delete-orphan", passive_deletes=True). it > will then issue a DELETE for all child records that are present in the > session, but leave those which arent loaded alone, for your database > CASCADE to take care of. > This sounds like what i need. Thanks Michael.
> but it doesn't seem to do what I > >> thought. I just want SA not to do an update on the child records (or >> anything else on the child records), just delete the main record. >> > > the only other option here is to set viewonly=True on the relation(). > but then it wouldnt process save operations either. > > Thanks for the tip on viewonly. I like the sound of it. huy --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---