KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So I have a dict passed from a web page. I want to build the query dynamically based on the dict. I know I can do: session.query(myClass).filter_by(**web_dict) However, that only works when the values are an exact match. I need to do 'like' filtering. My best attempt using the __dict__ attribute: for k,v in web_dict.items(): q = session.query(myClass).filter(myClass.__dict__[k].like('%%%s%%' % v)) Not sure how to build the query from there. Any help would be awesome.
Tags (comma-separated)
Save Edits
Cancel