Hi Alexander,
On 23/06/2010 12:28, Alexander Zhabotinskiy wrote:
Hello. I'v got an problem
I have a string like 'john' and I need to get results for 'john, JOHN'
etc. How to do that?
I do it like this. force db column and search string to upper and I put
a "%" before and after the search string so it looks anywhere within the
db column.
aFilter = "UPPER(%s) LIKE '%s%s%s'" % ('cb_namesandvar',
'%',
'esslin'.upper(),
'%')
wines = session.query(db.Vcbook).filter(aFilter).all()
for wine in wines:
print wine.cb_namesandvar
On my test db this produces:
Goldwater Esslin, Merlot
Goldwater Esslin, Merlot
Werner
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.