SQLAlchemy and Alembic 2 · Querying
Get exactly one row
scalar_one() raises if there is not exactly one match; first() returns None for no match.
user = session.scalars(select(User).where(User.email == "[email protected]")).one()
Official SQLAlchemy and Alembic 2 documentation