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'])
精彩评论