Skip to content

Commit 6da40b4

Browse files
Revert addition of oracledb.ConnectionError since it isn't strictly
necessary and more time is needed to consider whether it is an improvement or not! Adjusted release notes in preparation for release of 1.0.1.
1 parent e0da4b4 commit 6da40b4

File tree

4 files changed

+36
-47
lines changed

4 files changed

+36
-47
lines changed

doc/src/release_notes.rst

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,47 @@ python-oracledb Release Notes
77

88
For deprecations, see :ref:`Deprecations <deprecations>`.
99

10-
1110
oracledb 1.0.1 (TBD)
1211
--------------------
1312

14-
#) Thick: restored support for bequeath connections.
15-
#) Thick: fixed issue fetching NCLOB with
16-
`oracledb.defaults.fetch_lobs = False`.
17-
#) Thin: added support for multiple aliases in one entry in tnsnames.ora
13+
Thin Mode Changes
14+
+++++++++++++++++
15+
16+
#) Added support for multiple aliases in one entry in tnsnames.ora
1817
(`issue 3 <https://github.com/oracle/python-oracledb/issues/3>`__).
19-
#) Thin: return the same value for timestamp with time zone columns as thick
20-
(`issue 7 <https://github.com/oracle/python-oracledb/issues/7>`__).
21-
#) Thin: fixed retry count handling to work in cases where the listener is
22-
running but the service is down
18+
#) Fixed connection retry count handling to work in cases where the database
19+
listener is running but the service is down
2320
(`issue 3 <https://github.com/oracle/python-oracledb/issues/3>`__).
24-
#) Thin: if an error occurs during the creation of a connection to the
25-
database, the error is wrapped by DPY-6005 as an instance of
26-
oracledb.ConnectionError.
27-
#) Thin: fixed order in which bind data is sent to the server when LONG and
21+
#) Return the same value for TIMESTAMP WITH TIME ZONE columns as thick mode
22+
(`issue 7 <https://github.com/oracle/python-oracledb/issues/7>`__).
23+
#) Fixed order in which bind data is sent to the server when LONG and
2824
non-LONG column data is interspersed
2925
(`issue 12 <https://github.com/oracle/python-oracledb/issues/12>`__).
30-
#) Thin: ensure that errors that occur during fetch are detected consistently.
31-
#) Thin: fixed issue when fetching null values in implicit results.
32-
#) Thin: small optimization when sending column metadata.
26+
#) If an error occurs during the creation of a connection to the database, the
27+
error is wrapped by DPY-6005 (so that it can be caught with an exception
28+
handler on class oracledb.DatabaseError).
29+
#) Ensured that errors occurring during fetch are detected consistently.
30+
#) Fixed issue when fetching null values in implicit results.
31+
#) Small performance optimization when sending column metadata.
32+
33+
Thick Mode Changes
34+
++++++++++++++++++
35+
36+
#) Restored support for bequeath connections to a local database.
37+
#) Fixed issue fetching NCLOB columns with
38+
`oracledb.defaults.fetch_lobs = False`.
39+
40+
Common Changes
41+
++++++++++++++
42+
3343
#) Fixed issue where unconstrained numbers containing integer values would be
34-
fetched as floats when oracledb.defaults.fetch_lobs was set to `False`
44+
fetched as floats when `oracledb.defaults.fetch_lobs = False`.
3545
(`issue 15 <https://github.com/oracle/python-oracledb/issues/15>`__).
36-
#) Ensured the name of wrapped functions are the same as the function being
37-
wrapped in order to improve error messages that reference them.
38-
#) Added exception class (oracledb.ConnectionError) as a subclass of
39-
oracledb.DatabaseError in order to aid the handling of connection errors
40-
during creation or use (where the connection is no longer usable or could
41-
not be established).
42-
#) Improved samples and documentation.
46+
#) Ensured connection error messages contain the function name instead of
47+
``wrapped()``.
48+
#) Improved samples, including adding a Dockerfile that starts a container
49+
with a running database and the samples.
50+
#) Improved documentation.
4351

4452

4553
oracledb 1.0.0 (May 2022)

src/oracledb/errors.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(self, message: str=None, context: str=None,
6868
args = re.search(pattern, message).groupdict()
6969
else:
7070
driver_error_num = driver_error_info
71-
if driver_error_num in ERR_CONNECTION_ERROR_SET:
71+
if driver_error_num == ERR_CONNECTION_CLOSED:
7272
self.is_session_dead = True
7373
driver_error = _get_error_text(driver_error_num, **args)
7474
self.message = f"{driver_error}\n{self.message}"
@@ -99,10 +99,7 @@ def _raise_err(error_num: int, context_error_message: str=None,
9999
message = _get_error_text(error_num, **args)
100100
if context_error_message is not None:
101101
message = f"{message}\n{context_error_message}"
102-
if error_num in ERR_CONNECTION_ERROR_SET:
103-
exc_type = exceptions.ConnectionError
104-
else:
105-
exc_type = ERR_EXCEPTION_TYPES[error_num // 1000]
102+
exc_type = ERR_EXCEPTION_TYPES[error_num // 1000]
106103
raise exc_type(_Error(message)) from cause
107104

108105

@@ -239,15 +236,6 @@ def _raise_from_string(exc_type: Exception, message: str) -> None:
239236
1080: ERR_CONNECTION_CLOSED,
240237
}
241238

242-
# dead connection errors
243-
ERR_CONNECTION_ERROR_SET = set([
244-
ERR_CONNECTION_CLOSED,
245-
ERR_CONNECTION_FAILED,
246-
ERR_INVALID_SERVICE_NAME,
247-
ERR_INVALID_SID,
248-
ERR_LISTENER_REFUSED_CONNECTION
249-
])
250-
251239
# error message exception types (multiples of 1000)
252240
ERR_EXCEPTION_TYPES = {
253241
1: exceptions.InterfaceError,

src/oracledb/exceptions.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
#------------------------------------------------------------------------------
2626
# exceptions.py
2727
#
28-
# Contains the exception classes mandated by the Python Database API and one
29-
# additional one (ConnectionError) for aiding in the handling of connection
30-
# failures when the connection is being created or used (and the connection is
31-
# no longer usable).
28+
# Contains the exception classes mandated by the Python Database API.
3229
#------------------------------------------------------------------------------
3330

3431
class Warning(Exception):
@@ -43,10 +40,6 @@ class DatabaseError(Error):
4340
pass
4441

4542

46-
class ConnectionError(DatabaseError):
47-
pass
48-
49-
5043
class DataError(DatabaseError):
5144
pass
5245

src/oracledb/impl/thin/connection.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ cdef class ThinConnImpl(BaseConnImpl):
230230
address)
231231
if redirect_params is not None:
232232
return redirect_params
233-
except exceptions.ConnectionError:
233+
except exceptions.DatabaseError:
234234
if raise_exception:
235235
raise
236236
return

0 commit comments

Comments
 (0)