Answer the question
In order to leave comments, you need to log in
How to implement case insensitive search in python?
In an asynchronous web application, I make case-insensitive queries against a database (aiosqlite) to look up a full name from a list of real-time profiles:
async def query(*args):
name,lastname = [x.upper()+"%" for x in args]
async with aiosqlite.connect(Host.DBPATH) as db:
cursor = await db.execute("SELECT * FROM profile WHERE UPPER(name) LIKE ? OR UPPER(lastname) LIKE ?",(name,lastname))
return await cursor.fetchall()
Answer the question
In order to leave comments, you need to log in
You can, as a quick solution, duplicate the data in the table, processing it from the outside with an upper case transformation.
Then you will have to submit already converted (prepared for the index format) data to the input to the queries.
And here there is an article on how to add collate for Russian case-insensitive comparison.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question