Reputation: 2043
Is there anyway to delete an object based on some conditions? For example, if cascade:delete-orphan
is indicated in a relationship, it will delete the child when the parent is deleted. What I am looking for is to delete an object when some condition is satisfied.
Upvotes: 0
Views: 298
Reputation: 75207
perhaps you're looking for query.delete() ?
session.query(MyClass).filter_by(some_col='fred').delete(synchronize_session=False)
Upvotes: 2