Skip to content

Commit d93397f

Browse files
Force thin mode to be enabled when creating connections or pools with
asyncio, thus improving the error message and also ensuring that thick and thin modes to not run concurrently.
1 parent 5fd1065 commit d93397f

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

doc/src/release_notes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ Common Changes
104104
#) All Oracle errors that result in the connection no longer being usable will
105105
be raised as ``DPY-4011: the database or network closed the connection``
106106
with the underlying reason being included in the error message.
107+
#) Error ``DPY-2053: python-oracledb thin mode cannot be used because thick
108+
mode has already been enabled`` is now raised when attempting to use
109+
asyncio in thick mode
110+
(`issue 448 <https://github.com/oracle/python-oracledb/issues/448>`__).
107111
#) Error ``DPY-2056: registered handler for protocol "{protocol}" failed for
108112
arg "{arg}"`` is now raised when an exception occurs when calling the
109113
registered handler for a protocol.

src/oracledb/connection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,7 @@ def connect_async(
19841984

19851985
# build connection class and call the implementation connect to
19861986
# actually establish the connection
1987+
oracledb.enable_thin_mode()
19871988
return conn_class(dsn, pool, params, kwargs)
19881989

19891990
return connect_async

src/oracledb/pool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,7 @@ def create_pool_async(
11051105
params=params,
11061106
**kwargs,
11071107
)
1108+
oracledb.enable_thin_mode()
11081109
if not issubclass(pool_class, AsyncConnectionPool):
11091110
errors._raise_err(errors.ERR_INVALID_POOL_CLASS)
11101111
return pool_class(dsn, params=params, cache_name=pool_alias, **kwargs)

utils/templates/connection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,7 @@ def connect_async(
17471747

17481748
# build connection class and call the implementation connect to
17491749
# actually establish the connection
1750+
oracledb.enable_thin_mode()
17501751
return conn_class(dsn, pool, params, kwargs)
17511752

17521753
return connect_async

utils/templates/pool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ def create_pool_async(
799799
params=params,
800800
**kwargs,
801801
)
802+
oracledb.enable_thin_mode()
802803
if not issubclass(pool_class, AsyncConnectionPool):
803804
errors._raise_err(errors.ERR_INVALID_POOL_CLASS)
804805
return pool_class(dsn, params=params, cache_name=pool_alias, **kwargs)

0 commit comments

Comments
 (0)