primaryjoin =  """and_(Article.author_id == AuthorOverride.author_id , 

> Article.topic_id == AuthorOverride.topic_id , 
> AuthorOverride.is_published == True)
>
  """,
                   foreign_keys = ( Article.author_id , Article.topic_id),

Solved .  I was close.

1. Wrap the join conditions in and_()
2. Add in a foreign_keys argument

I had seen the "and_()" syntax before, but forgot about it.  It's only in 
the ORM narrative ( 
http://docs.sqlalchemy.org/en/rel_0_8/orm/relationships.html#specifying-alternate-join-conditions
 
)  , but not the API docs 
( 
http://docs.sqlalchemy.org/en/rel_0_8/orm/relationships.html#sqlalchemy.orm.relationship
 
), which made it harder to find.

The foreign keys bit was in the narrative only, but not the API 
( 
http://docs.sqlalchemy.org/en/rel_0_8/orm/relationships.html#creating-custom-foreign-conditions
 
)


-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to