On 19/02/14 15:28, Michael Bayer wrote:
On Feb 19, 2014, at 1:14 PM, Mariano Mara <[email protected]> wrote:# relationships runner = relationship("User", foreign_keys=[uid, oid], #primaryjoin=and_("Bet.uid==User.uid", "Bet.oid==User.oid"), ) loader = relationship("User", foreign_keys=[loader_uid, oid])you've got the quoting off on that commented-out primaryjoin, here's the most direct way to set it up: runner = relationship("User", primaryjoin="and_(foreign(Bet.uid)==User.uid, foreign(Bet.oid)==User.oid)", ) loader = relationship("User", primaryjoin="and_(foreign(Bet.loader_uid)==User.uid, foreign(Bet.oid)==User.oid)", )
I have tried with the primaryjoin too (although not including the foreign()) and I hit a different error. Your suggestion -of course- works.
I am confuse now: when do I use the primaryjoin and/or foreign_keys and/or foreign?
Thanks in advance! -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
