I am trying to query my PostgreSQL database using row lists. I want to return all rows whose column matches this row, and I would like it to be case insensitive in order to find more things.
fruits = ['apple', 'orange', 'pear', 'grape', 'watermelon', 'asian pear']
In this case, the "Asian pear" can be capitalized in the database.
obs = session.query(datamodel).filter(datamodel.fruitname._in(fruits)).all()
I know about func.lower (), and I use this for individual requests, but I'm not sure where to put it when using.
I would use func.lower like this in one question:
obs =session.query(datamodel).filter(func.lower(datamodel.fruitname)==func.lower(fruits[5]))).first()
source
share