I would like to have a delete-orphan cascade rule, so that I can delete the children of a post when it gets deleted. I set up the mapper like this:
cls.mapper=db.mapper(cls,table,is_primary=True,properties={ 'kits': db.relation(Post,cascade='all, delete-orphan') }) where cls is my post class, and db is sqlalchemy. Ok... this is the error: ArgumentError: Cant establish 'delete-orphan' cascade rule on a self-referential relationship (attribute 'kits' on class 'Post'). You probably want cascade='all', which includes delete cascading but not orphan detection. But... http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_recursive That example right there establishes delete-orphan on a self referential relationship. Is it outdated? If I were a post, must I manually recurse through all my kits before deleting myself? I'll leave off the delete-orphan part for now, and manually recurse, but it does seem curious to see such an error. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users