many-to-one relationship interpretation by query
consolidating #1328, #2797, #2845 as these are all dealing with the same thing from different angles.
SomeClass.some_m2o, which refers to OtherEntity as a many-to-one, would be interpreted:
-
for
sess.query(SomeClass.some_m2o)
assess.query(OtherEntity)
-
for
sess.query(SomeClass).filter(SomeClass.some_m2o == OtherEntity)
asfilter(SomeClass.other_entity_id == OtherEntity.id)
-
for
sess.query(SomeClass).order_by(SomeClass.some_m2o), group_by(SomeClass.some_m2o)
, asorder_by/group_by SomeClass.other_entity_id
-
as is currently the case,
sess.query(SomeClass).filter(SomeClass.some_m2o == other_entity)
compares to other_entity.id
any other query.something(SomeClass.m2o..something)
type requests should get put here.
Comments (4)
-
reporter -
reporter - edited description
- changed milestone to 1.0
lets try for this one on the next big release though I continue to not care too much about this myself
-
reporter still low priority for me
-
reporter - changed milestone to 1.x.xx
still just a nice to have that doesn't get requested much
- Log in to comment
Issue
#2989was marked as a duplicate of this issue.