summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-08-18 13:04:14 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-08-22 14:44:39 -0400
commit53175850bf1e238b968adf025d8de6ac28d6203c (patch)
tree37269ddc7697d6fa258146d74f7d836727cce0d8
parentd6018ef3a29142826a0408456c459c32809cb698 (diff)
downloadsqlalchemy-53175850bf1e238b968adf025d8de6ac28d6203c.tar.gz
First level repair for cx_Oracle 6.0 test regressions
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)
-rw-r--r--lib/sqlalchemy/dialects/oracle/cx_oracle.py4
-rw-r--r--test/engine/test_reconnect.py3
-rw-r--r--test/requirements.py7
3 files changed, 12 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
index cc5a22fc0..2578ec0d6 100644
--- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py
+++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
@@ -858,6 +858,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:
@@ -966,7 +967,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
diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py
index db70436e0..e25475209 100644
--- a/test/engine/test_reconnect.py
+++ b/test/engine/test_reconnect.py
@@ -858,6 +858,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")
diff --git a/test/requirements.py b/test/requirements.py
index d43434095..58ba0bc18 100644
--- a/test/requirements.py
+++ b/test/requirements.py
@@ -697,8 +697,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,