specify the join as an "on" condition:

q.join(Time.account)
q.join(Time.job)

Bryan wrote:
>
> I have a table 'Time' that has many-to-1 relationships to tables 'Job'
> and 'Account'.  There is also a 1-to-many relationship between job and
> Account.
>
> Tables
> ----------------------------------------------
> Time
>    --> Account
>    --> Job
> Job --> Account
>
> I am trying to pull back a few rows from Time, Job and Account via the
> orm library.  I want to try and avoid using the actual sql objects.
>
> I can't join them simply like below because the reference between Job
> and Account is making the join ambiguous.  I want to join Time to Job
> and Time to Account.
>
> q = orm.query(
>       func.sum(Time.hours),
>       Time.day,
>       Job.number,
>       Account.code
>      )
> q = q.join(Job)
> q = q.join(Account)
>
> How can i tell sqlalchemy to join Job and Account to Time, and not to
> eachother?
>
> Bryan
>
> >
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to