from sqlalchemy import inspect
from sqlalchemy.orm import lazyload
user = session.query(User).options(lazyload(User.articles)).first()
How to find out if a lazy relation isn't loaded yet, with SQLAlchemy?