I have a list of of SQLAlchemy Model attributes. For example:
my_list = ['firstName', 'lastName']
I also have a person SQLAlchemy Object with firstName and lastName attributes.
I want to search query my database for people with a query as follows:
session.filter( Person.lastName.like(query+'%') | Person.firstName.like(query+'%')).all()
The tricky part is that I want to generate the above filter dynamically from the my_list list. For example if an emailAddress is added to the list I want the query to also search via the objects email property.