Query API — SQLAlchemy 2.0.0b1 documentation

From Get docs

Query API

This section presents the API reference for the ORM _query.Query object. For a walkthrough of how to use this object, see ormtutorial_toplevel.

The Query Object

_query.Query is produced in terms of a given Session, using the query() method:

q = session.query(SomeMappedClass)

Following is the full interface for the _query.Query object.

ORM-Specific Query Constructs