How can I get the query result filter_by the capital or lower letter?

19 views
Skip to first unread message

DoDo

unread,
Oct 27, 2012, 11:41:06 AM10/27/12
to sqlal...@googlegroups.com
I try to use the query with filter_by function to grab the data from a table. But it can't get the correct return.

session. query(testtable).filter_by(code = '1A')
session. query(testtable).filter_by(code = '1a')

How should I specify the capital letter or lower letter in filter_by function?



DoDo

unread,
Nov 1, 2012, 1:47:09 AM11/1/12
to sqlal...@googlegroups.com
I find the answer that I need to use the utf_bin during the Column definition.
Something like below:

code = Column(VARCHAR(10, collation='utf8_bin'), nullable = False)

then I can get the case sensitive support from the query filter.






DoDo於 2012年10月27日星期六UTC+8下午11時41分06秒寫道:
Reply all
Reply to author
Forward
0 new messages