PostgreSQL ILIKE query with SQLAlchemy
I think it should work
Post.query.filter(Post.title.ilike('%some_phrase%'))
For python 3.6 instead of '%' + some_phrase + '%'
you can write
Post.query.filter(Post.title.ilike(f'%{some_phrase}%'))
There is another workable solution:
from sqlalchemy.sql.operators import ilike_opPost.query.filter(ilike_op(Post.title, f'%{some_phrase}%'))
This solution helped me to overcame the warning Unresolved attribute reference 'ilike' for class 'property'
when I used hybrid_property