]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Evaluate fixes for cx_Oracle 8 API changes
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Apr 2020 16:23:32 +0000 (12:23 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Apr 2020 20:48:35 +0000 (16:48 -0400)
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

doc/build/changelog/unreleased_13/5246.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/oracle/cx_oracle.py

diff --git a/doc/build/changelog/unreleased_13/5246.rst b/doc/build/changelog/unreleased_13/5246.rst
new file mode 100644 (file)
index 0000000..c535ce2
--- /dev/null
@@ -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.
+
index 3a3bbad2506c4b0fade3dc17fb03d1f1f273a5e8..dd255b2ed8d5076ba688f2c6f394525179287638 100644 (file)
@@ -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):