I\'d like to run a query that selects all posts, case insensitive, that have titles that match \'%\' + [some_phrase] + \'%\'
. That is, select all rows that have
For python 3.6 instead of '%' + some_phrase + '%'
you can write
Post.query.filter(Post.title.ilike(f'%{some_phrase}%'))
I think it should work
Post.query.filter(Post.title.ilike('%some_phrase%'))
http://docs.sqlalchemy.org/en/latest/orm/internals.html?highlight=ilike#sqlalchemy.orm.attributes.QueryableAttribute.ilike