two foreign keys in one model sqlalchemy duplicate
<p>There are other answers on stacked overflow and I followed them. Its been 3 days with this problem and i have searched all answers before and i feel that even if  its repeat question i should be afraid to ask if I cant get it to work after much researching.</p>

<p>the desired result is foreign keys in one model using sqlalchemy</p>

<pre><code>class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)

class OrderHistory(db.Model):    
    id = db.Column(db.Integer(), primary_key=True)

    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    seller_id = db.Column(db.Integer, db.ForeignKey('user.id'))

    user = db.relationship(User, foreign_keys=[user_id], backref='user')
    seller = db.relationship(User, foreign_keys=[seller_id], backref='seller')
</code></pre>

<p>But i keep getting this error</p>

<pre><code>AmbiguousForeignKeysError: Could not determine join condition between parent/child tables on relationship User.order_history - there are multiple foreign key paths linking the tables.  Specify the 'foreign_keys' argument, providing a list of those columns which should be counted as containing a foreign key reference to the parent table.
</code></pre>

<p>What am i dong wrong?</p>

<p>Checkout <a href="http://docs.sqlalchemy.org/en/latest/orm/join_conditions.html#self-referential-many-to-many-relationship" rel="nofollow">this example</a> on the documentation. Probably you are using a sqlalchemy version &lt;= 0.8 and that's why your code your code won't work.</p>

python sqlalchemy