[sqlalchemy] Re: Inferring joins from table A to table C via table B

2009-09-03 Thread Damon
MUST we explicitly supply the join to such query objects? Or is there some way that SA can figure out that tbl_people_documents is in between tbl_people and tbl_documents on its own? Perhaps there is something we can add to the tbl_people/tbl_documents object definitions that clues SA

[sqlalchemy] Re: Inferring joins from table A to table C via table B

2009-09-03 Thread Michael Bayer
Damon wrote: MUST we explicitly supply the join to such query objects? Or is there some way that SA can figure out that tbl_people_documents is in between tbl_people and tbl_documents on its own? Perhaps there is something we can add to the tbl_people/tbl_documents object definitions

[sqlalchemy] Re: Inferring joins from table A to table C via table B

2009-09-03 Thread Damon
Thank you very much for the explanation. It is what I feared was the case. One of the great features we love about SA is the mappers, allowing us to define table relationships in such a way that we can decide what table(s) around which to pivot, giving us different ways of returning data even

[sqlalchemy] Re: Inferring joins from table A to table C via table B

2009-09-03 Thread Michael Bayer
Damon wrote: Thank you very much for the explanation. It is what I feared was the case. One of the great features we love about SA is the mappers, allowing us to define table relationships in such a way that we can decide what table(s) around which to pivot, giving us different ways of

[sqlalchemy] Re: Inferring joins from table A to table C via table B

2009-09-03 Thread Jae Kwon
you can explicitly create these many-to-many join relations and eager load them. users = session.query(User).options(eagerload(User.groups)).all() if you want to query for relations with a filter, AFAIK you need to define them as a separate relation. class User(...) groups =

[sqlalchemy] Re: Inferring joins from table A to table C via table B

2009-09-01 Thread Michael Bayer
Damon wrote: MUST we explicitly supply the join to such query objects? Or is there some way that SA can figure out that tbl_people_documents is in between tbl_people and tbl_documents on its own? Perhaps there is something we can add to the tbl_people/tbl_documents object definitions that