what about CLOB type? Unicode only handles String type. Do i need to use convert_unicode there?
On Mon, Aug 3, 2015 at 6:56 PM, Mike Bayer <mike...@zzzcomputing.com> wrote: > > > On 8/1/15 12:12 PM, Abhishek Sharma wrote: > > Thanks for help. But still i have confusion over encoding and decoding > procedure which will take place before retrieving and storing the results > in DB. > > In case if i am not using convert_unicode option and data type is String > so python process will give str object to sqlalchemy at the time of insert > record in DB using ORM. So will alchemy store that object in encoded form?. > So at the time of retrieving ORM will give str object for String type > column to python and python decode that object with default encoding? > > Can i simply use Unicode Data type for columns where there might be chance > of using non ascii data? > > > if you know that your unicode data is on specific columns then yes, the > Unicode type plugs in an encoder/decoder for those backends that require > it. > > > > > > On Thu, Jul 30, 2015 at 2:55 AM, Mike Bayer <mike...@zzzcomputing.com> > wrote: > >> >> >> 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> >> 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 <sqlalchemy+unsubscr...@googlegroups.com> >> sqlalchemy+unsubscr...@googlegroups.com. >> To post to this group, send email to <sqlalchemy@googlegroups.com> >> sqlalchemy@googlegroups.com. >> 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 a topic in the >> Google Groups "sqlalchemy" group. >> To unsubscribe from this topic, visit >> <https://groups.google.com/d/topic/sqlalchemy/eThubIMnL4o/unsubscribe> >> https://groups.google.com/d/topic/sqlalchemy/eThubIMnL4o/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> sqlalchemy+unsubscr...@googlegroups.com. >> To post to this group, send email to <sqlalchemy@googlegroups.com> >> sqlalchemy@googlegroups.com. >> 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 sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > 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 a topic in the > Google Groups "sqlalchemy" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sqlalchemy/eThubIMnL4o/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.