you want to use the "primaryjoin" argument to establish explicitly the
conditions by which each Post relationship to Comparation, an example is at
http://www.sqlalchemy.org/docs/orm/relationships.html#specifying-alternate-join-conditions-to-relationship
.
On Dec 16, 2010, at 12:16 PM, Alvaro Reinoso wrote:
> Hi all,
>
> I have this table:
>
> class Comparation(Base):
> """Represents comparation between two post"""
> __tablename__ = "comparations"
>
> _id = Column("id", Integer, primary_key=True)
> _number = Column("number", Integer)
> _total = Column("total", Integer)
> _average = Column("average", Float)
> _postAId = Column("postA_id", Integer, ForeignKey("posts.id"))
> _postBId = Column("postB_id", Integer, ForeignKey("posts.id"))
>
> _postA = relationship("Post", uselist=False)
> _postB = relationship("Post", uselist=False)
>
> It has two ForeignKeys pointing the same table, but it also has two
> relationships related to those ForeignKeys. How can I relate _postAId
> to _postA?
>
> Thanks in advance!
>
> --
> 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.
>
--
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.