I'm not sure if this is possible.  I was hoping it was, but my attempts so 
far didn't work.  I've got a separate select going, but would love to pare 
things down to one.

I'm wanting to map a relationship where two columns match ( not one ) and 
there is a boolean filter

Class Author:
id = sa.Column(sa.Integer ,primary_key=True)

Class AuthorOverride:
id = sa.Column(sa.Integer ,primary_key=True)
author_id = sa.Column(sa.Integer, sa.ForeignKey("author.id") )
topic_id = sa.Column(sa.Integer, sa.ForeignKey("topic.id") )
    is_published = sa.Column(sa.Boolean, nullable=True, default=None)
class Article:
id = sa.Column(sa.Integer,primary_key=True)
author_id = sa.Column(sa.Integer, sa.ForeignKey("author.id") )
topic_id = sa.Column(sa.Integer, sa.ForeignKey("topic.id") )

    author = sa.orm.relationship("Author",uselist=False)

author_override = sa.orm.relationship(\
"AuthorOverride",
primaryjoin =  """Article.author_id == AuthorOverride.author_id , 
Article.topic_id == AuthorOverride.topic_id , 
AuthorOverride.is_published == True
""",
uselist=False
)



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