[sqlalchemy] Re: Specifying Alternate Join Conditions to relation()

2009-07-15 Thread Michael Bayer
GHZ wrote: boston_addresses = relation('Address', primaryjoin = and_ ('User.user_id==Address.user_id', 'Address.city==Boston'), foreign_keys = ['Address.user_id']) the expression sent to primaryjoin must be an expression

[sqlalchemy] Re: Specifying Alternate Join Conditions to relation()

2009-07-15 Thread Mike Conley
I was getting ready to do something similar, and now I am confused. How is what GHZ is doing fundamentally different from the documentation example Specifying Alternate Join Conditions to relation()? Doesn't that example wrap the primaryjoin in the and_() construct also?

[sqlalchemy] Re: Specifying Alternate Join Conditions to relation()

2009-07-15 Thread Michael Bayer
Mike Conley wrote: I was getting ready to do something similar, and now I am confused. How is what GHZ is doing fundamentally different from the documentation example Specifying Alternate Join Conditions to relation()? Doesn't that example wrap the primaryjoin in the and_() construct also?

[sqlalchemy] Re: Specifying Alternate Join Conditions to relation()

2009-07-15 Thread Mike Conley
Ahh!! Starting to understand it. In this case, the entire expression to primaryjoin must be a string. The explanation about eval'ing the string when mappers are compiled makes sense. Now I see the relation in GHZ's example and in the code I will be writing should look something like this.