[pysqlite] Strings coming back as Unicode.

"Harish Vishwanath" <[email protected]> Mon, 24 Nov 2008 10:28:51 +0530
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
Hello All,

I am using Pysqlite2.5.0 on top of Python 2.5 with Elixir and SqlAlchemy as
ORM packages.

>>> from elixir import *
>>> class A(Entity):
...     name = Field(String(40))
...
>>> metadata.bind = "sqlite:///c:\\temp.sqlite"
>>> metadata.bind.echo = True
>>> setup_all(True)
>>> a = A(name="Ascii")
>>> session.flush()
>>> session.commit()
>>> b = session.query(A)[0]
>>> b.name
u'Ascii'
>>>
>>> type(b.name)
<type 'unicode'>


I have set proper options in SqlAlchemy/Elixir to NOT TO Convert strings to
Unicode automatically. I went through PySqlite's docs and found that there
is a connection.text_factory option which I can set to 'str' to avoid this
conversion. But since I use SQLAlchemy, I have no control over the
connection it obtains from Sqlite3 Dialect.

Is there any way, to set connection.text_factory=str by default? Kindly let
me know.

Thanks!


-- 
Regards,
Harish

_______________________________________________
list-pysqlite mailing list
list-pysqlite-FR6EJeJVuqdwc357pe9rcyQmJico6nz3epZhswDD4dQ@public.gmane.org
http://itsystementwicklung.de/cgi-bin/mailman/listinfo/list-pysqlite