SQLAlchemy and Alembic 2 · Updating and raw SQL

Delete a row

Delete an object and commit.

session.delete(session.get(Post, 1))
session.commit()

Caution: Deletes are permanent after commit. Back up first if unsure.

Official SQLAlchemy and Alembic 2 documentation

More updating and raw sql commands

All updating and raw sql commands · SQLAlchemy and Alembic 2 cheatsheet

Was this page helpful?