On 7/29/15 2:23 PM, Abhishek Sharma wrote:
We are using sqlalchemy version 0.7, python 2.7 and oracle Database.
We have ASCII as default python encoding and DB have ISO-8052
encoding. Our DB tables contains some of characters which are out of
ASCII range. So when we are running query on those tables we are
getting Unicode Decode error saying "ASCII" codec can not decode. This
error we are getting without accessing model attributes.
How i can handle these errors without changing python default encoding.
Oracle's client encoding is controlled by the NLS_LANG environment
variable. That has to be set correctly first off (see
http://www.oracle.com/technetwork/products/globalization/nls-lang-099431.html).
If you have non-ASCII strings encoded in datatypes that are explicitly
not of type NVARCHAR or NCLOB , or you're relying on a lot of raw SQL,
and you are still getting errors, I would set the
"coerce_to_unicode=True" flag on create_engine(), which allows
cx_Oracle's unicode facilities to take place fully for all string data
being returned, at the expense of some performance. See
http://docs.sqlalchemy.org/en/rel_1_0/dialects/oracle.html#unicode for
background.
--
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]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.