title: composite two foreign key in sqlalchemy?
body: <p>I am using SQLALchemy in flask. And I am confused how to define composite key with two foreign keys.
  One foreign key from one table and second from another table.</p>
  
  <pre><code>class Store_category_mapping(db.Model):
  
      __tablename__ = 'store_category_mapping' 
      category_id = db.Column(db.Integer, nullable=False) 
      store_id = db.Column(db.Integer, nullable=False)
      store_name    = db.Column(db.String(50),  nullable=False)
  
      __table_args__ = (
          db.ForeignKeyConstraint(
              [category_id, store_id],
              [Category_master.category_id, Store_master.store_id]
          ),
          )
  </code></pre>
  
  <p>It gives this error:</p>
  
  <blockquote>
    <p>sqlalchemy.exc.ArgumentError: ForeignKeyConstraint on
    store_category_mapping(category_id, store_id) refers to multiple
    remote tables: category_master and store_master</p>
  </blockquote>