Skip to content

Commit 2537c26

Browse files
Added property for "sdu" on connections.
1 parent 4e7c63f commit 2537c26

File tree

6 files changed

+41
-1
lines changed

6 files changed

+41
-1
lines changed

doc/src/api_manual/connection.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,20 @@ Connection Attributes
804804

805805
This attribute is an extension to the DB API definition.
806806

807+
.. attribute:: Connection.sdu
808+
809+
This read-only attribute specifies the size of the Session Data Unit (SDU)
810+
that is being used by the connection. The value will be the lesser of the
811+
requested python-oracledb size and the maximum size allowed by the database
812+
network configuration. It is available only in the python-oracledb Thin
813+
mode.
814+
815+
.. versionadded:: 2.0.0
816+
817+
.. note::
818+
819+
This attribute is an extension to the DB API definition.
820+
807821
.. attribute:: Connection.service_name
808822

809823
This read-only attribute specifies the Oracle Database service name

doc/src/release_notes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Thin Mode Changes
1717
(`issue 6 <https://github.com/oracle/python-oracledb/issues/6>`__).
1818
#) Added parameter :attr:`ConnectParams.sdu` for configuring the Session Data
1919
Unit (SDU) size for sizing internal buffers used for tuning communication
20-
with the database.
20+
with the database. The connection property :attr:`Connection.sdu` was also
21+
added.
2122
#) Added parameter :data:`ConnectParams.ssl_context` to modify the SSL context
2223
used when connecting via TLS
2324
(`issue 259 <https://github.com/oracle/python-oracledb/issues/259>`__).

src/oracledb/connection.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,15 @@ def outputtypehandler(self, value: Callable) -> None:
366366
self._verify_connected()
367367
self._impl.outputtypehandler = value
368368

369+
@property
370+
def sdu(self) -> int:
371+
"""
372+
Specifies the size of the Session Data Unit (SDU) that is being used by
373+
the connection.
374+
"""
375+
self._verify_connected()
376+
return self._impl.get_sdu()
377+
369378
@property
370379
def service_name(self) -> str:
371380
"""

src/oracledb/impl/base/connection.pyx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ cdef class BaseConnImpl:
249249
def get_max_open_cursors(self):
250250
pass
251251

252+
@utils.CheckImpls("getting the session data unit (SDU)")
253+
def get_sdu(self):
254+
pass
255+
252256
@utils.CheckImpls("getting the service name")
253257
def get_service_name(self):
254258
pass

src/oracledb/impl/thin/connection.pyx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ cdef class BaseThinConnImpl(BaseConnImpl):
266266
def get_max_open_cursors(self):
267267
return self._max_open_cursors
268268

269+
def get_sdu(self):
270+
return self._protocol._caps.sdu
271+
269272
def get_service_name(self):
270273
return self._service_name
271274

utils/templates/connection.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,15 @@ def outputtypehandler(self, value: Callable) -> None:
364364
self._verify_connected()
365365
self._impl.outputtypehandler = value
366366

367+
@property
368+
def sdu(self) -> int:
369+
"""
370+
Specifies the size of the Session Data Unit (SDU) that is being used by
371+
the connection.
372+
"""
373+
self._verify_connected()
374+
return self._impl.get_sdu()
375+
367376
@property
368377
def service_name(self) -> str:
369378
"""

0 commit comments

Comments
 (0)