我想查询两个SqlAlchemy类ConfBrand和ConfFeature。如果在ConfFeature.brand和ConfBrand.id上存在匹配,那么我将获得数据,否则它是一个空列表。通常,ConfFeature将是一个空表。
>>> result_query = vert_session.query(ConfBrand, ConfFeature)\
.filter(ConfFeature.brand == ConfBrand.id)\
.filter(ConfBrand.type==0).all()
>>> result_query
[]
我尝试做一个outer_join(),但是我收到一个错误,说明confbrand不是唯一的?
result_query = vert_session.query(ConfBrand, ConfFeature).outerjoin(ConfBrand, (ConfFeature.brand == ConfBrand.id)).filter(ConfBrand.type==0).all()