Hi, I'm trying to use the secondary argument to create a relation that joins two tables through an intermediary. SQLAlchemy says that it can't figure out the correlation automatically. There are other relations and mappings going on here on these tables, but the base of this is as follows. Relations don't have any "correlate" keyword like queries. Any input?
class Sequence(BaseStruct, Base): __tablename__ = 'sequence' __table_args__ = ( {'autoload':True} ) class FamilySequence(BaseStruct, Base): __tablename__ = 'family_sequence' __table_args__ = ( ForeignKeyConstraint(['sequence_key'], ['protein.sequence_key']), ForeignKeyConstraint(['family_key'], ['family.id']), {'autoload':True} ) sequence = relation(Sequence,primaryjoin="FamilySequence.sequence_key==Sequence.id",lazy=True) class Family(BaseStruct, Base): __tablename__ = 'family' __table_args__ = ( {'autoload':True} ) proteins = relation(Protein,secondary=FamilySequence.__table__,primaryjoin="Family.id==FamilySequence.family_key",secondaryjoin="FamilySequence.sequence_key==Protein.sequence_key",lazy=True,uselist=True,backref="families") InvalidRequestError: Select statement 'SELECT count(family_sequence.sequence_key) AS count_1 FROM family_sequence, family WHERE family.id = family_sequence.family_key' returned no FROM clauses due to auto-correlation; specify correlate() to control correlation manually. -- Patrick -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.