ArgumentError: relationship expects a class or mapper argument

后端 未结 1 895
隐瞒了意图╮
隐瞒了意图╮ 2020-12-14 15:43

I am getting this strange error, and I\'m saying strange because I made a change to an unrelated table.

I am trying to query my tDevice table which look

相关标签:
1条回答
  • 2020-12-14 16:26

    not happy with myself since it's such a dumb mistake but here is my culprit:

    report_type = relationship('tReportType',
                               uselist=False,
                               backref=backref('report'))
    

    should be:

    report_type = relationship('TReportType',
                               uselist=False,
                               backref=backref('report'))
    

    capital T instead of t, I should be referencing the class, not my actual table name: 'tReportType' -> 'TReportType'

    0 讨论(0)
提交回复
热议问题