From: Christopher Jones Date: Tue, 31 May 2022 12:27:18 +0000 (-0400) Subject: Handle dead-connection errors for users of python-oracledb X-Git-Tag: rel_1_4_37~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8564e2abf97795819f655a70b19b3bc820729c79;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Handle dead-connection errors for users of python-oracledb Added two new error codes for Oracle disconnect handling to support early testing of the new "python-oracledb" driver released by Oracle. Fixes: #8066 Closes: #8065 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8065 Pull-request-sha: d630b8457a1d29b7a1354ccc6d5e2956eea865f6 Change-Id: Ib14dbb888597b1087b1bb7c505ccad59df226177 (cherry picked from commit 2bf00472bfafd8fd0cca5b4fe55ff4faf1a1279e) --- diff --git a/doc/build/changelog/unreleased_14/8066.rst b/doc/build/changelog/unreleased_14/8066.rst new file mode 100644 index 0000000000..5f814ab3ab --- /dev/null +++ b/doc/build/changelog/unreleased_14/8066.rst @@ -0,0 +1,6 @@ +.. change:: + :tags: usecase, oracle + :tickets: 8066 + + Added two new error codes for Oracle disconnect handling to support early + testing of the new "python-oracledb" driver released by Oracle. diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py index 4c89ed7355..64029a4796 100644 --- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py +++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py @@ -1335,9 +1335,12 @@ class OracleDialect_cx_oracle(OracleDialect): # TODO: Others ? return True - if re.match(r"^(?:DPI-1010|DPI-1080)", str(e)): + if re.match(r"^(?:DPI-1010|DPI-1080|DPY-1001|DPY-4011)", str(e)): # DPI-1010: not connected # DPI-1080: connection was closed by ORA-3113 + # python-oracledb's DPY-1001: not connected to database + # python-oracledb's DPY-4011: the database or network closed the + # connection # TODO: others? return True