Using inreg with peewee (SQLite)

Skip to first unread message


Feb 11, 2021, 11:23:01 AM2/11/21
to peewee-orm

Right now I have a database filled with warning records for my discord server, the only problem is when someone is trying to search for a record, it has the match the EXACT case. Is there a way to make insensitive? I've looked at the docs and found an inreg operation but I kept on getting syntax errors.

My current setup:


databaseData = [database.MRP_Blacklist_Data.DiscUsername, database.MRP_Blacklist_Data.DiscID, database.MRP_Blacklist_Data.Gamertag, database.MRP_Blacklist_Data.BannedFrom, database.MRP_Blacklist_Data.KnownAlts, database.MRP_Blacklist_Data.ReasonforBan, database.MRP_Blacklist_Data.DateofIncident, database.MRP_Blacklist_Data.TypeofBan, database.MRP_Blacklist_Data.DatetheBanEnds] 
 for data in databaseData:
 query = ( == req))).get() 
for p in query: 
#do stuff

Although I keep getting syntax errors and im not sure how I would include the inregexp. 

Charles Leifer

Feb 11, 2021, 11:31:20 AM2/11/21
You have several problems. The first is sqlite does not implement regexp so you need to bring your own implementation, which is trivial. But to set that aside for now, the real issue is your where clause makes no sense.

What you want is this:


Which translates into a case-insensitive LIKE:

.where( ** ('%' + req + '%'))

You received this message because you are subscribed to the Google Groups "peewee-orm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages