SqlAlchemy. TypeError: filter_by() takes exactly 1 argument (2 given)

半腔热情 提交于 2019-12-01 08:57:07

Without seeing code, obviously you are calling filter_by wrong. filter_by takes only the implicit self (the 'exactly 1 argument' meaning exactly 1 positional argument) and optional keyword arguments. You are providing filter_by another positional argument, possibly a dictionary.

The syntax is:

query.filter_by(column1=value, column2=value)

Whereas for filter:

query.filter(Model.column1 == value, Model.column2 == value)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!