zugnush wrote: > > There seem to be a lot of people getting unicode when they want str. > > I want unicode, I've tried to force it with the connection > parameters. I get it for the column heading but not the value. > > Can anyone explain to me what I'm doing wrong. > > Thanks > Neil > > In [121]: import sqlalchemy > > In [122]: engine = sqlalchemy.create_engine > (oracle_conn_string,convert_unicode=True,assert_unicode=True) > > In [123]: conn = engine.connect() > > In [124]: r=conn.execute("select location from sc.location1m1 where > location like 'North Sydney%220%'") > > In [125]: r.fetchone().items() > Out[125]: [(u'LOCATION', 'North Sydney \xbf Site Code 220')]
SQLA does the "convert unicode" thing when you use a SQL expression that involves the Unicode type. So the above would look like: conn.execute(text("select location from sc.location1m1 where location like 'North Sydney%220%'", typemap={'location':Unicode})) > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---