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?
http://www.sqlalchemy.org/docs/05/mappers.html#specifying-alternate-join-conditions-to-relation I can reproduce GHZ's error with declarative, but also can run the documentation example using mappers. Can we express the alternate joins with declarative? -- Mike Conley On Wed, Jul 15, 2009 at 10:39 AM, Michael Bayer <mike...@zzzcomputing.com>wrote: > > 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 construct, or a > string which can be eval'ed to produce one. You can't wrap the > to-be-eval'ed construct inside of an expression construct (i.e. and_() in > this case). > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---