Sqlalchemy does not create my foreign key in Python Programming Language?

editAnswer

reportReport

Answer(s) available: 1

Amaresh Borah

, Construction Manager, Technical Issues

"

relation() only tells the mapper how are the two tables related. You still need to add a column with the foreign key information. For example:

"
class B(Base):"
    __tablename__ = 'bs'"
    id = Column(Integer, primary_key=True)"
    a_id = Column(Integer, ForeignKey('as.id'), name="a")"
    a = relation(A)"
"

thumb_upUpvote13

smsComment

reportReport