DazWorrall's answer is the point. Here's an option that may be useful if your code is structured differently than OP:
num_rows_deleted = db.session.query(Model).delete()
In addition, do not forget that the deletion will not take effect until you commit, as in this fragment:
try: num_rows_deleted = db.session.query(Model).delete() db.session.commit() except: db.session.rollback()
Steve Saporta Aug 21 '14 at 19:28 2014-08-21 19:28
source share