AFAIK SQLite returns unicode objects for TEXT
in Python. Is it possible to get SQLite to return string objects instead?
views:
36answers:
2
A:
TEXT
is intended to store text. Use BLOB
if you want to store bytes.
Ignacio Vazquez-Abrams
2010-09-08 09:44:20
Yes but why unicode necessarily? A lot of python libraries I use don't really like unicode. And I'd hate doing `str` conversions because it looks ugly and sometimes I can't be sure of the type of the data that I am trying to convert.
c00kiemonster
2010-09-08 10:14:46
Text is Unicode. Unicode is text. Don't want Unicode? Don't use text.
Ignacio Vazquez-Abrams
2010-09-08 10:51:22
+1
A:
On further inspection of the Python SQLite API, I found this little bit:
http://docs.python.org/library/sqlite3.html#sqlite3.Connection.text_factory
Case closed.
c00kiemonster
2010-09-08 10:29:44