After I create MySQL connection I have to patch it in order to work with my character encoding. Here is what I'm currently doing:

from sqlalchemy.ext.proxy import AutoConnectEngine

__engine__ = AutoConnectEngine('mysql', dict(db='test', user='test', host=' 192.168.1.70'), encoding='latin2')

con = __engine__.engine.connection().connection
con.charset = 'latin2'
con.cursor().execute("SET NAMES 'latin2'")


I guess this only works for the current thread.

I would like to invoke last two statements every time a mysql connection is made.

Reply via email to