Alex Rivera | Logout

SQL Alchemy - How to delete a model instance?

Asked 2010-07-23T21:03:19.503
27

Say I have a model instance like this:

instance = session.query(MyModel).filter_by(id=1).first()

How can I delete that row? Is there a special method to call?

Edit
Report

1 Answer

45

Ok I found it after further searching:

session.delete(instance)
answered 2010-07-23T22:11:43.417

Your Answer