Mike, many thanks for your feedback!

On 2018-01-12 16:33, Mike Bayer wrote:
> On Fri, Jan 12, 2018 at 7:14 AM, Stefan Schwarzer
> <sschwar...@sschwarzer.net> wrote:
>> I have trouble inserting Chinese characters into an Oracle database with
>> SQLAlchemy (and to some extent with cx_Oracle). I don't specifically need
>> Chinese characters but I used them in a unit test to see if my code
>> (hopefully) can handle "any" unicode characters.
> 
> I can't reproduce your result, I'm not using any SQL tool I am instead
> just getting the same data back and asserting it matches.

I'm doing the same in the unit test. I saw different characters
from what I had supposedly inserted and checked with the SQL tool
to get a clue whether the insert or the select was the problem.

> Per the
> author of  cx_Oracle the setinputsizes call is no longer needed in
> most cases in the 6.x series, but also in the 1.x series, the
> autosetinputsizes call for UNICODE and STRING was omitted because I
> still got poorer results.   Round-tripping of unicode characters is
> widely tested with cx_Oracle / SQLAlchemy.
>
> In SQLAlchemy 1.1 series and earlier, you can specify
> exclude_setinputsizes=() to have STRING be part of the automatic
> setinputsizes call.

At the moment, I'm using SQLAlchemy 1.1.15 at the moment due to
the fractional-second problem (described in my other mail), but
would like to switch to SQLAlchemy 1.2.x when the fractional-second
problem is fixed there.

> In SQLAlchemy 1.2 these features were all removed
> as there was never any reason to pass most datatypes to setinputsizes.
>   in 1.2 you can still say
> engine.dialect._include_setinputsizes.add(cx_Oracle.STRING) to re-add
> it, but this should not be necessary (my test works with or without
> it).
> 
> Also which version of Python you're using matters, however I get a
> round trip under both pythons.

Sorry, I forgot to mention this. The Python version was 3.6.3,
if I remember correctly.

> To round trip it, do this - note I had to expand the size of the
> VARCHAR to fit your string, it was giving me a "data too large" error
> before, so that might be a clue:

I'll try your script next week when I have access to the database
system.

Best regards,
Stefan

-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to