attributeError:' mapper'从SQLalchemy 1.3更新到1.4后,对象没有属性
我在这里与sqlalchemy 1.4
有问题。
使用sqlalchemy 1.3
,调用别名
工作,但是
def query(self, patient_id):
cls = self.__class__
checkin = aliased(cls.relationship_one)
study = aliased(checkin.relationship_two)
# A query is done here
# Omitted for brevity
return result
,如果我将sqlalchemy更新为1.4
我得到以下错误
attributeError :'mapper'对象没有属性'relatess_two'
在更新和使用参考列的属性之后,我遇到了一些类似的错误,
alias = aliased(cls.relationship_1)
alias.my_column
但我通过感谢
alias.c.my_column # Note the .c here
您的任何帮助
I'm having an issue here with SQLAlchemy 1.4
.
With SQLAlchemy 1.3
, the calls to aliased
work, like this
def query(self, patient_id):
cls = self.__class__
checkin = aliased(cls.relationship_one)
study = aliased(checkin.relationship_two)
# A query is done here
# Omitted for brevity
return result
However, if I updated SQLAlchemy to 1.4
I get the following error
AttributeError: 'Mapper' object has no attribute 'relationship_two'
I've gotten some similar errors after updating and using attributes referring to columns like
alias = aliased(cls.relationship_1)
alias.my_column
But I fixed it by using
alias.c.my_column # Note the .c here
Thanks for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论