summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2022-02-24 14:44:44 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2022-02-24 14:44:44 +0000
commit381894b50ea7e16b4950ecbdda72c0fa45de8d1c (patch)
treecff92f26b61576dd209127a15d8e41886f83a702 /lib/sqlalchemy
parent11333602c0f844e32f12af114f1dfcb160408fcf (diff)
parent8f9e971f10dee0614054671e0c284f0acace2d04 (diff)
downloadsqlalchemy-381894b50ea7e16b4950ecbdda72c0fa45de8d1c.tar.gz
Merge "support cx_Oracle DPI disconnect codes" into main
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/dialects/oracle/cx_oracle.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
index 3f8109a12..a390099ae 100644
--- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py
+++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
@@ -1233,7 +1233,14 @@ class OracleDialect_cx_oracle(OracleDialect):
) and "not connected" in str(e):
return True
- if hasattr(error, "code"):
+ if hasattr(error, "code") and error.code in {
+ 28,
+ 3114,
+ 3113,
+ 3135,
+ 1033,
+ 2396,
+ }:
# ORA-00028: your session has been killed
# ORA-03114: not connected to ORACLE
# ORA-03113: end-of-file on communication channel
@@ -1241,9 +1248,15 @@ class OracleDialect_cx_oracle(OracleDialect):
# ORA-01033: ORACLE initialization or shutdown in progress
# ORA-02396: exceeded maximum idle time, please connect again
# TODO: Others ?
- return error.code in (28, 3114, 3113, 3135, 1033, 2396)
- else:
- return False
+ return True
+
+ if re.match(r"^(?:DPI-1010|DPI-1080)", str(e)):
+ # DPI-1010: not connected
+ # DPI-1080: connection was closed by ORA-3113
+ # TODO: others?
+ return True
+
+ return False
def create_xid(self):
"""create a two-phase transaction ID.