-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Labels
featureNew feature requestNew feature request
Description
✅ Describe your idea or issue
SQLite allows for a LIKE operator that performs wildcard searches, but as far as I can tell, it's not accessible in SQLLEX, at least not when criteria are given as a dict, like this:
jerrys = db['users'].select(ALL, WHERE={'name': ['LIKE', 'Jerry%']})or this:
jerrys = db['users'].select(ALL, WHERE={'name': ['%', 'Jerry%']})Would you be willing to add support for this?
✅ Additional context
It's possible to enable support, at least in this specific use-case, by adding "LIKE" to the recognized operators listed here, and patching it to add spaces when necessary, like so:
if len(values) > 1 and values[0] in [
"<", "<<", "<=",
">=", ">>", ">",
"=", "==", "!=",
"<>", "LIKE",
]:
operator = values.pop(0)
if operator == 'LIKE':
operator = ' LIKE 'But that's a pretty hacky solution, and I don't know how it interacts with the other ways to write WHERE statements, so I figured I would file an issue instead of a PR.
v1a0 and damnkratv1a0
Metadata
Metadata
Assignees
Labels
featureNew feature requestNew feature request