I just installed the latest 0.3 version of SA (0.3.10). How does one tell SqlAlchemy to cascade on delete within a TurboGears context?
I use MySql with InnoDB and I have ondelete cascade working on the tables. So, if I delete an account directly via sql, the user records are correctly deleted. But with SA, deleting an account does not delete the user records. I saw in SA docs a rough description of how to do ondelete cascade using the passive_deletes=True arg in a mapper. But I'm not sure how it applies through the TG layer. I tried adding ondelete="CASCADE" to the ForeignKey constructor call in the account column (below) based on example here: http://www.sqlalchemy.org/docs/03/adv_datamapping.html This did not work. Child rows not deleted. Any help much appreciated! James INFO: I have accounts with one-to-many users in model.py: class User(ActiveMapper): """ Reasonably basic User definition. Probably would want additional attributes. """ class mapping: __table__ = "tg_user" user_id = column(Integer, primary_key=True) user_name = column(Unicode(16), unique=True) email_address = column(Unicode(255), unique=True) display_name = column(Unicode(255)) last_name = column(Unicode(255)) first_name = column(Unicode(255)) password = column(Unicode(40)) created = column(DateTime, default=datetime.now) nonce = column(Unicode(50)) account = column(Integer, foreign_key=ForeignKey("account.id")) primary = column(Integer) class Account(ActiveMapper): class mapping: __table__ = "account" id = column(Integer, primary_key=True) account_name = column(Unicode(50), unique=True) number = column(Unicode(50), unique=True) gateway_cust_num= column(Unicode(50)) created = column(DateTime, default=datetime.now) company = column(Unicode(50)) address = column(Unicode(50)) address2 = column(Unicode(50)) city = column(Unicode(50)) state = column(Unicode(20)) zip = column(Unicode(20)) phone = column(Unicode(20)) cc_last_4 = column(Unicode(10)) users = one_to_many('User') invoices = one_to_many('Invoice') plan_id = column(Integer) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---