Hello!

I have gtk application with sqlite db, contain russian words.

My model

<code>
class Patient(Base):
    lastname = Column(Unicode)
</code>

Search operation

<code>
patients = self.session.query(Patient)

lastname = unicode(self.lastname_entry.get_text())
if lastname:
     patients = patients.filter(Patient.lastname.like(u"%%%s%%" %
lastname))
</code>

It perfectly work if i search as 'Ivanov', but didn't return results
if i search 'ivanov'. Note, i search russian words, not english.

In SQLite manager (firefox plugin) search query

<code>
SELECT * FROM patients WHERE lastname LIKE "%ivanov%"
</code>

If i query db and look at value:

<code>
In [28]: p.lastname
Out[28]: u'\u0413\u0430\u043f\u0447\u0443\u043a'
</code>

and than check it in query, generated by SQLAlchemy

<code>
In [29]: patients.filter(Patient.lastname.ilike(u"%%%s%%" %
l.decode('utf-8'))).count()

2011-01-20 21:20:30,950 INFO sqlalchemy.engine.base.Engine.0x...1250
SELECT count(1) AS count_1
FROM patients
WHERE lower(patients.lastname) LIKE lower(?)
2011-01-20 21:20:30,950 INFO sqlalchemy.engine.base.Engine.0x...1250
(u'%\u0433\u0430\u043f\u0447\u0443\u043a%',)
Out[29]: 0
</code>

It is looked like lower function in SQLAlchemy didn't understood
cyrillic ...

Thanks!

PS: Sorry for my english)

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to