Search code examples
pythonsqlalchemyorm

SQL Alchemy - How to delete a model instance?


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?


Solution

  • Ok I found it after further searching:

    session.delete(instance)