]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
First level repair for cx_Oracle 6.0 test regressions
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 18 Aug 2017 17:04:14 +0000 (13:04 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 22 Aug 2017 18:46:17 +0000 (14:46 -0400)
Fixed more regressions caused by cx_Oracle 6.0; at the moment, the only
behavioral change for users is disconnect detection now detects for
cx_Oracle.DatabaseError in addition to cx_Oracle.InterfaceError, as
this behavior seems to have changed.   Other issues regarding numeric
precision and uncloseable connections are pending with the upstream
cx_Oracle issue tracker.

Change-Id: Id61f1e33b21c155a598396340dfdecd28ff4066b
Fixes: #4045
(cherry picked from commit 03255a5a0fc6aa8acfff99ed9e62d58054b8b6af)

lib/sqlalchemy/dialects/oracle/cx_oracle.py
test/engine/test_reconnect.py
test/requirements.py

index 24a9217ddfdf88ee20f694263b38b6504a8ba25d..fecaa0039fdfaf81a4924f7e55563fffa75bad99 100644 (file)
@@ -852,6 +852,7 @@ class OracleDialect_cx_oracle(OracleDialect):
                                 size, precision, scale):
             # convert all NUMBER with precision + positive scale to Decimal
             # this almost allows "native decimal" mode.
+
             if self.supports_native_decimal and \
                     defaultType == cx_Oracle.NUMBER and \
                     precision and scale > 0:
@@ -957,7 +958,8 @@ class OracleDialect_cx_oracle(OracleDialect):
 
     def is_disconnect(self, e, connection, cursor):
         error, = e.args
-        if isinstance(e, self.dbapi.InterfaceError):
+        if isinstance(e, (
+                self.dbapi.InterfaceError, self.dbapi.DatabaseError)):
             return "not connected" in str(e)
         elif hasattr(error, 'code'):
             # ORA-00028: your session has been killed
index 39ebcc91ba24db0788575f169bbc1f9d1b4e7b95..bcdf8ab8ed7c24becb368178b7e59bf11ff1e7fa 100644 (file)
@@ -748,6 +748,9 @@ class InvalidateDuringResultTest(fixtures.TestBase):
         self.meta.drop_all()
         self.engine.dispose()
 
+    @testing.crashes(
+        "oracle",
+        "cx_oracle 6 doesn't allow a close like this due to open cursors")
     @testing.fails_if([
         '+mysqlconnector', '+mysqldb', '+cymysql', '+pymysql', '+pg8000'],
         "Buffers the result set and doesn't check for connection close")
index 6833e5e9b577f2104b1a4e2f9c9cd56776b82100..2e79d9225b02bdede2370952f46b9b3b6aa6f295 100644 (file)
@@ -618,12 +618,18 @@ class DefaultRequirements(SuiteRequirements):
         such as 319438950232418390.273596, 87673.594069654243
 
         """
+        def cx_oracle_6_config(config):
+            return config.db.driver == "cx_oracle" and \
+                config.db.dialect.cx_oracle_ver >= (6, )
+
         return fails_if(
-                    [('sqlite', None, None, 'TODO'),
-                    ("firebird", None, None, "Precision must be from 1 to 18"),
-                    ("sybase+pysybase", None, None, "TODO"),
-                    ('mssql+pymssql', None, None, 'FIXME: improve pymssql dec handling')]
-                )
+            [cx_oracle_6_config,
+             ('sqlite', None, None, 'TODO'),
+             ("firebird", None, None, "Precision must be from 1 to 18"),
+             ("sybase+pysybase", None, None, "TODO"),
+             ('mssql+pymssql', None, None,
+              'FIXME: improve pymssql dec handling')]
+        )
 
     @property
     def precision_numerics_retains_significant_digits(self):