flask sqlalchemy case insensitive like

To perform a case-insensitive "like" query using Flask-SQLAlchemy, you can follow these steps:

  1. Import the necessary modules: python from sqlalchemy import func

  2. Use the ilike() method to perform a case-insensitive "like" query: python results = YourModel.query.filter(func.lower(YourModel.column_name).ilike("your_search_term")).all()

  3. Replace YourModel with the name of your model and column_name with the name of the column you want to query. Replace "your_search_term" with the term you want to search for in a case-insensitive manner.