views:

36

answers:

2

AFAIK SQLite returns unicode objects for TEXT in Python. Is it possible to get SQLite to return string objects instead?

A: 

TEXT is intended to store text. Use BLOB if you want to store bytes.

Ignacio Vazquez-Abrams
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
Text is Unicode. Unicode is text. Don't want Unicode? Don't use text.
Ignacio Vazquez-Abrams
+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