class User(Base):
    id = Column(Integer, primary_key=True)
name = Column(String, nullable=False, unique=True)
How to use joinedload/contains_eager for query-enabled relationships (lazy='dynamic' option) in SQLAlchemy