]> 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>
Fri, 18 Aug 2017 17:04:14 +0000 (13:04 -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
lib/sqlalchemy/dialects/oracle/cx_oracle.py
test/engine/test_reconnect.py
test/requirements.py

index 4e9f6314b44589a15286501c7443c447e22faedd..86562dfd0f67ae226506b78c7702331d1a58b264 100644 (file)
@@ -863,6 +863,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:
@@ -971,7 +972,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 f798ff8456abb09f2b059438a4064fd3309e5215..c690ae77285c56e26117daccbe4a7f9f57e355a5 100644 (file)
@@ -1003,6 +1003,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 a83b8b5338593061788d922904fac9e19477ffdd..737d654ae3cd7b1d4d39a12745f642e9f44a51d9 100644 (file)
@@ -713,8 +713,13 @@ 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'),
+            [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,