On Nov 12, 2011, at 2:36 AM, sector119 wrote: > Hi. > > I think that I'm doing somethig wrong, but I can't get delete-orphah work... > No DELETES on static_page_urls are performed... > > session = Session() > user = session.query(StaticPage).filter_by(id=1).delete()
delete and delete-orphan cascade doesn't take effect with aggregate delete() calls against a Query. If you wanted this behavior you can get your database to do it (if supported) using "ON DELETE CASCADE" on your foreign keys. query.delete() also does not return an object, just a count of rows affected. For the delete cascade to take effect you'd say: static_page = s.query(StaticPage).filter_by(id=1).one() s.query(static_page) -- 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.
