Why I get TraceBack sqlalchemy.exc.NoForeignKeysError: Could not determine join condition between parent/child tables on relationship County.Legislators - there are no foreign keys linking these tables. Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify a 'primaryjoin' expression. sqlalchemy.exc.NoForeignKeysError: Could not determine join condition between parent/child tables on relationship County.Legislators - there are no foreign keys linking these tables. Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify a 'primaryjoin' expression.
class County(Base): __tablename__ = 'tblCounty' CountyCode = Column('CountyCode', String, primary_key=True) Legislators = relationship('Legislators', backref='County', lazy='dynamic') class Legislators(Base): __tablename__ = 'VLegislators' EmployeeNo = Column('EmployeeNo', String, primary_key=True) CountyCode = Column('CountyCode', String, ForeignKey('County.CountyCode'))
I am trying to map a public MS SQL database provided by New Hampshire. Therefore, no circuit changes are allowed.
Why does he complain about the lack of a ForeignKey relationship when he is clearly defined in the Legislators class?
python sqlalchemy
Dan garthwaite
source share