I'm constructing a query using SQLAlchemy and SQLite3 in which I'd like to select rows in which a String column contains a particular substring. What is the best way to accomplish this?
You can filter using contains operator:
contains
Model.query.filter(Model.columnName.contains('sub_string'))
To negate in, use not_ operator with it:
not_
Model.query.filter(not_(Model.columnName.contains('sub_string')))
2.1m questions
2.1m answers
60 comments
57.0k users