I get the following error:
u\'detail\': u\"One or more mappers failed to initialize - can\'t proceed with initialization of other mappers. Original exc
SQLAlchemy is unable to discover the relationship path.
user_id = Column(ForeignKey('user.id'))
user = relationship(User, backref=backref('votes_user'))
responder_id = Column(ForeignKey('user.id'))
responder = relationship(User, backref=backref('votes_responder'))
Do the responder
relationship must join using responder_id
or user_id
? I know it is obvious to us, but SQLAlchemy don't consider column names here. You can rename responder_id
as foobar
and it'll make no difference.
Define the foreign keys you want to use for each relationship.
user = relationship(User, foreign_keys=[user_id], backref=backref('votes_user'))
responder = relationship(User, foreign_keys=[responder_id], backref=backref('votes_responder'))