| 2789 | bs = relationship("B") |
| 2790 | |
| 2791 | class B(Base): |
| 2792 | __tablename__ = "b" |
| 2793 | id = Column(Integer, primary_key=True) |
| 2794 | a_id = Column(ForeignKey("a.id")) |
| 2795 | |
| 2796 | A.b_count = deferred( |
| 2797 | select(func.count(1)).where(A.id == B.a_id).scalar_subquery() |