Hi, 

I was looking into create_engine options enocding and convert_unicode and 
it seems it works for ORM but not for executing raw sql. 
Is that intentional or I'm missing something? 

from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.sql import text

def get_first_name(engine):
    row = engine.execute(text('SELECT FirstName FROM Customer LIMIT 
1')).fetchone()
    print row[0]

    Base = automap_base()
    Base.prepare(engine, reflect=True)
    Customer = Base.classes.Customer
    c1 = Session(engine).query(Customer).first()
    print c1.FirstName
    print 5*'--'


engine = create_engine('mysql://chinook:[email protected]:3309/Chinook')
unicode_engine = 
create_engine('mysql://chinook:[email protected]:3309/Chinook', 
encoding='latin1', convert_unicode=True)

get_first_name(engine)
get_first_name(unicode_engine)


The output was 
Lu�s
Lu�s
----------
Lu�s
Luís
----------

Kind regards, 
Michal

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to