[Sqlalchemy-tickets] [sqlalchemy] #2846: many-to-one relationship interpretation by query
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-10-18 16:25:21
|
#2846: many-to-one relationship interpretation by query
-------------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: high | Milestone: 0.9.xx
Component: orm | Severity: major - 1-3 hours
Keywords: | Progress State: in queue
-------------------------+------------------------------------
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:
1. for `sess.query(SomeClass.some_m2o)` as `sess.query(OtherEntity)`
2. for `sess.query(SomeClass).filter(SomeClass.some_m2o == OtherEntity)`
as `filter(SomeClass.other_entity_id == OtherEntity.id)`
3. for `sess.query(SomeClass).order_by(SomeClass.some_m2o),
group_by(SomeClass.some_m2o)`, as `order_by/group_by
SomeClass.other_entity_id`
4. 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.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2846>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|