Opened 8 years ago

Last modified 8 years ago

#27429 closed New feature

had to use QuerySet.extra to do WHERE LIKE with arbitrary amount / placement of wildcard characters — at Version 1

Reported by: Lance Robertson Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: QuerySet.extra
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Lance Robertson)

My use case is that I'm trying to find phonetic patterns that rhyme using a database I built from the pronunciation dictionary CMUdict

For example:

Pronunciation.objects.extra(where=["code LIKE '%% - %%__1 - S T __0 D'"])

I want to be able to filter with % and _ wildcards in arbitrary amounts and places in the search string beyond just contains, startswith, and endswith, and the only way I could figure out how to do it is either to use a raw query or .extra - if .extra goes away I hope filter will support this behavior!

Change History (1)

comment:1 by Lance Robertson, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top