SQLAlchemy and Alembic 2 · Engine, models and tables

Open a session

A session is a unit of work. Use it as a context manager so it always closes.

from sqlalchemy.orm import Session

with Session(engine) as session:
    ...

Official SQLAlchemy and Alembic 2 documentation

More engine, models and tables commands

All engine, models and tables commands · SQLAlchemy and Alembic 2 cheatsheet

Was this page helpful?