class A(Base):
    __tablename__ = 'a'
id = Column(Integer, primary_key=True)
bs = relationship('B')


class B(Base):
    __tablename__ = 'b'
id = Column(Integer, primary_key=True)
a_id = Column(Integer, ForeignKey('a.id'))
e = create_engine('sqlite://', echo=True)
SQLAlchemy ORM select multiple entities from subquery