我有一些 sqlalchemy 查询:
>>> items = (
Company.query
.add_column(Address.city)
.join(Company.address)
.filter(and_(
...some filters...
))
.all()
)
>>> items
[(Company(6239), Berlin), (Company(5388), Moscow), ...]
如何修改我的查询,将 Address.city 放入实体公司?我希望它看起来像:
...
>>> items
[Company(6239), Company(5388), ...]
>>> items[0].city
Berlin
谢谢你。