On Dec 29, 2007, at 12:46 AM, Jonathan Gardner wrote:

>
> I'm getting a strange error when I specify primaryjoin in relation().

the error is because of the allow_column_override, combined with the  
fact that you haven't reassigned the column attributes for "left" and  
"right".   the "left" and "right" columns on table2 need to be  
available as scalar attributes on your Table2 class since thats how  
foreign key attributes are tracked.

so get rid of the "allow_column_override" (any error message that says  
"specify X to ignore this condition" is pretty much a red flag) and  
set up the foreign key columns as something:

mapper(Table2, table2, properties={
     '_left':table2.c.left,
     '_right':table2.c.right,
    'left':relation(Table1,
        primaryjoin=table1.c.id==table2.c.left),
    'right':relation(Table1,
        primaryjoin=table1.c.id==table2.c.right),

})



--~--~---------~--~----~------------~-------~--~----~
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