Need a not case sensitive search code(beginner)

I want to search my database table without case sensitive letters

I copied the code from the tutorial, but the tutorial is case sensitive.(Database Search and Filter) I think

@anvil.server.callable
def search_genetic(query):
result = app_tables.genetic.search()
if query:
result = [
x for x in result
if query in x[‘brand’]
or query in x[‘name’]
or query in x[‘genetic’]
]
return result

https://anvil.works/build#clone:F4FNP6Q7IWEAJW3W=J7NJ2RHNQGZLF5TIP74UM33H

Using the following code the database engine rather than python will do the filtering, which is thousands of times faster.

@anvil.server.callable
def search_genetic(query):
    return app_tables.genetic.search(
        q.any_of(
            brand=q.ilike(f'%{query}%'),
            name=q.ilike(f'%{query}%'),
            genetic=q.ilike(f'%{query}%'),
        )
    )

:point_up_2: what @stefano.menci said.

Also here is the tutorial on how to use the database engine queries that are very fast and powerful.
There is even an app to clone at the bottom of that page that gives you live syntax in action with a clone link: