From: Mike Bayer Date: Fri, 10 Apr 2020 16:23:32 +0000 (-0400) Subject: Evaluate fixes for cx_Oracle 8 API changes X-Git-Tag: rel_1_4_0b1~403^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24137da80da879e7792f45302ae5c100524253be;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Evaluate fixes for cx_Oracle 8 API changes in [1] we have reported some behavioral changes in cx_Oracle symbols. As it is unclear if these are intended changes in cx_Oracle, test workarounds for these changes against cx_Oracle master. [1] https://github.com/oracle/python-cx_Oracle/issues/415 Fixes: #5246 Change-Id: If63f92553c46484bf2b61b53a9e6d85cb08e800a --- diff --git a/doc/build/changelog/unreleased_13/5246.rst b/doc/build/changelog/unreleased_13/5246.rst new file mode 100644 index 0000000000..c535ce2e11 --- /dev/null +++ b/doc/build/changelog/unreleased_13/5246.rst @@ -0,0 +1,8 @@ +.. change:: + :tags: bug, oracle + :tickets: 5246 + + Some modifications to how the cx_oracle dialect sets up per-column + outputtype handlers for LOB and numeric datatypes to adjust for potential + changes coming in cx_Oracle 8. + diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index 3a3bbad250..dd255b2ed8 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -912,7 +912,11 @@ class OracleDialect_cx_oracle(OracleDialect): def output_type_handler( cursor, name, default_type, size, precision, scale ): - if default_type == cx_Oracle.NUMBER: + + if ( + default_type == cx_Oracle.NUMBER + and default_type is not cx_Oracle.NATIVE_FLOAT + ): if not dialect.coerce_to_decimal: return None elif precision == 0 and scale in (0, -127): @@ -934,9 +938,11 @@ class OracleDialect_cx_oracle(OracleDialect): ) # allow all strings to come back natively as Unicode - elif dialect.coerce_to_unicode and default_type in ( - cx_Oracle.STRING, - cx_Oracle.FIXED_CHAR, + elif ( + dialect.coerce_to_unicode + and default_type in (cx_Oracle.STRING, cx_Oracle.FIXED_CHAR,) + and default_type is not cx_Oracle.CLOB + and default_type is not cx_Oracle.NCLOB ): if compat.py2k: outconverter = processors.to_unicode_processor_factory( @@ -1064,7 +1070,6 @@ class OracleDialect_cx_oracle(OracleDialect): util.coerce_kw_type(opts, "threaded", bool) util.coerce_kw_type(opts, "events", bool) util.coerce_kw_type(opts, "purity", convert_cx_oracle_constant) - return ([], opts) def _get_server_version_info(self, connection):