8.30. SQLAlchemy Query About

8.30.1. Query

8.30.2. With Session

8.30.3. Select Columns

from sqlalchemy.orm import defer
from sqlalchemy.orm import undefer

session.query(Book).options(
    defer('*'), undefer('summary'), undefer('excerpt'))

A similar function is available with less verbosity by using the load_only() option. This is a so-called exclusionary option which will apply deferred behavior to all column attributes except those that are named:

from sqlalchemy.orm import load_only

session.query(Book).options(load_only(Book.summary, Book.excerpt))