开发者

filter_by usage problem in query building

I'm having some trouble in using SQLAlchemy filter_by:

for key in query_dict['filter']:
                query = query.filter_by(key=query_dict['filter'][key])   
开发者_如何学运维

apparently, filter_by won't accept the argument because it can't find the column named 'key' <-- literally! in the table

Is there anyway around this? Oh btw, is there a good link to learn about query building and chaining of sqlalchemy? Thanks.


I think this should work just fine:

query = query.filter_by(**query_dict['filter'])
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜