Skip to content

Commit a13093a

Browse files
Documentation updates.
1 parent 7a1e9e0 commit a13093a

File tree

8 files changed

+388
-279
lines changed

8 files changed

+388
-279
lines changed

doc/src/release_notes.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ oracledb `3.4.0 <https://github.com/oracle/python-oracledb/compare/v3.3.0...v3.4
1919
Thin Mode Changes
2020
+++++++++++++++++
2121

22-
#) Fixed bug when setting values of type ``datetime.date`` on variables of
23-
types :attr:`oracledb.DB_TYPE_TIMESTAMP`,
24-
:attr:`oracledb.DB_TYPE_TIMESTAMP_TZ` and
25-
:attr:`oracledb.DB_TYPE_TIMESTAMP_LTZ`.
22+
#) Fixed bug when setting values of type ``datetime.date`` on variables (such
23+
as created by :meth:`Cursor.var()` or implicitly by
24+
:meth:`Cursor.setinputsizes()`) of types
25+
:attr:`oracledb.DB_TYPE_TIMESTAMP`, :attr:`oracledb.DB_TYPE_TIMESTAMP_TZ`
26+
and :attr:`oracledb.DB_TYPE_TIMESTAMP_LTZ`.
2627
#) Fixed bug validating the database host during connection.
2728
#) Internal change: refactor encoding of Oracle data types.
2829
#) Internal change: small performance improvement sending bytes on the
@@ -39,9 +40,9 @@ Common Changes
3940

4041
#) Added support for all of the signed and unsigned fixed width integer types
4142
when ingesting data frames supporting the Arrow PyCapsule interface.
42-
Previously only int64 was supported.
43+
Previously only ``int64`` was supported.
4344
#) Added ``fetch_lobs`` and ``fetch_decimals`` parameters where applicable to
44-
the methods used for fetching rows or dataframes from the database. Note
45+
the methods used for fetching rows or data frames from the database. Note
4546
that for the creation of pipeline operations, if these parameters are not
4647
specified then the values of
4748
:attr:`oracledb.defaults.fetch_lobs <Defaults.fetch_lobs>` and
@@ -53,10 +54,10 @@ Common Changes
5354
support and :ref:`Cloud Native Authentication <cloudnativemodules>`
5455
support
5556
(`issue 512 <https://github.com/oracle/python-oracledb/issues/512>`__).
56-
#) Fixed bug when attempting to execute an empty statement
57-
(`issue 525 <https://github.com/oracle/python-oracledb/issues/525>`__).
5857
#) Pin Cython to 3.1.x instead of 3.1.0 as requested
5958
(`issue 530 <https://github.com/oracle/python-oracledb/issues/530>`__).
59+
#) Fixed bug when attempting to execute an empty statement
60+
(`issue 525 <https://github.com/oracle/python-oracledb/issues/525>`__).
6061
#) Fixed bug when attempting to convert an integer that cannot be represented
6162
as a native C ``int`` value to an Arrow data frame.
6263
#) API documentation is now generated from the source code.

doc/src/user_guide/bind.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ more than once with different data values. If you do not use bind variables,
3131
Oracle must reparse and cache multiple statements. When using bind variables,
3232
Oracle Database may be able to reuse the statement execution plan and context.
3333

34-
.. warning::
34+
.. important::
3535

3636
Never concatenate or interpolate user data into SQL statements:
3737

doc/src/user_guide/connection_handling.rst

Lines changed: 171 additions & 121 deletions
Large diffs are not rendered by default.

doc/src/user_guide/installation.rst

Lines changed: 165 additions & 124 deletions
Large diffs are not rendered by default.

doc/src/user_guide/sql_execution.rst

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,32 @@ executed. Statements are executed using one of these methods
2323
This chapter discusses python-oracledb's synchronous methods. The asynchronous
2424
methods and pipelining functionality are discussed in detail in :ref:`asyncio`.
2525

26-
PL/SQL statements are discussed in :ref:`plsqlexecution`. Other chapters
27-
contain information on specific data types and features. See :ref:`batchstmnt`,
28-
:ref:`lobdata`, :ref:`jsondatatype`, and :ref:`xmldatatype`.
26+
PL/SQL statements are discussed in :ref:`plsqlexecution`. The following
27+
chapters contain information on specific data types and features:
28+
29+
- :ref:`batchstmnt`
30+
- :ref:`pipelining`
31+
- :ref:`lobdata`
32+
- :ref:`jsondatatype`
33+
- :ref:`xmldatatype`
34+
35+
**Executing SQL Scripts**
2936

3037
Python-oracledb can be used to execute individual statements, one at a time.
3138
Once a statement has finished execution, only then will the next statement
3239
execute. If you try to execute statements concurrently in a single connection,
3340
the statements are queued and run consecutively in the order they are executed
34-
in the application code.
41+
in the application code. This includes :ref:`Pipelined statements
42+
<pipelining>`.
3543

3644
Python-oracledb does not read SQL*Plus ".sql" files. To read SQL files, use a
3745
technique like the one in ``run_sql_script()`` in `samples/sample_env.py
3846
<https://github.com/oracle/python-oracledb/blob/main/samples/sample_env.py>`__.
3947

40-
SQL statements should not contain a trailing semicolon (";") or forward slash
41-
("/"). This will fail:
48+
**SQL Statement Syntax**
49+
50+
SQL statements executed in python-oracledb should not contain a trailing
51+
semicolon (";") or forward slash ("/"). This will fail:
4252

4353
.. code-block:: python
4454
@@ -50,17 +60,6 @@ This is correct:
5060
5161
cursor.execute("select * from MyTable")
5262
53-
54-
SQL Queries
55-
===========
56-
57-
Queries (statements beginning with SELECT or WITH) can be executed using the
58-
method :meth:`Cursor.execute()`. Rows can then be iterated over, or can be
59-
fetched using one of the methods :meth:`Cursor.fetchone()`,
60-
:meth:`Cursor.fetchmany()` or :meth:`Cursor.fetchall()`. There is a
61-
:ref:`default type mapping <defaultfetchtypes>` to Python types that can be
62-
optionally :ref:`overridden <outputtypehandlers>`.
63-
6463
.. IMPORTANT::
6564

6665
Interpolating or concatenating user data with SQL statements, for example
@@ -69,6 +68,18 @@ optionally :ref:`overridden <outputtypehandlers>`.
6968
instead, for example ``cursor.execute("SELECT * FROM mytab WHERE mycol =
7069
:mybv", mybv=myvar)``.
7170

71+
72+
SQL Queries
73+
===========
74+
75+
Queries (statements beginning with SELECT or WITH) can be executed using the
76+
method :meth:`Cursor.execute()`. Rows can then be iterated over, or can be
77+
fetched using one of the methods :meth:`Cursor.fetchone()`,
78+
:meth:`Cursor.fetchmany()` or :meth:`Cursor.fetchall()`. This lets you handle
79+
rows directly or stream them if needed. There is a :ref:`default type mapping
80+
<defaultfetchtypes>` to Python types that can be optionally :ref:`overridden
81+
<outputtypehandlers>`.
82+
7283
.. _fetching:
7384

7485
Fetch Methods
@@ -98,9 +109,10 @@ Rows can be fetched in various ways.
98109
break
99110
print(row)
100111
101-
- If rows need to be processed in batches, the method :meth:`Cursor.fetchmany()`
102-
can be used. The size of the batch is controlled by the ``size`` parameter,
103-
which defaults to the value of :attr:`Cursor.arraysize`.
112+
- If rows need to be streamed or processed in batches, the method
113+
:meth:`Cursor.fetchmany()` can be used. The size of the batch is controlled
114+
by the ``size`` parameter, which defaults to the value of
115+
:attr:`Cursor.arraysize`.
104116

105117
.. code-block:: python
106118
@@ -116,8 +128,9 @@ Rows can be fetched in various ways.
116128
117129
Note the ``size`` parameter only affects the number of rows returned to the
118130
application, not to the internal buffer size used for tuning fetch
119-
performance. That internal buffer size is controlled only by changing
120-
:attr:`Cursor.arraysize`, see :ref:`tuningfetch`.
131+
performance. That internal buffer size is controlled only by changing
132+
:attr:`Cursor.arraysize` or :attr:`oracledb.defaults.arraysize
133+
<Defaults.arraysize>`, see :ref:`tuningfetch`.
121134

122135
- If all of the rows need to be fetched and can be contained in memory, the
123136
method :meth:`Cursor.fetchall()` can be used.

doc/src/user_guide/tuning.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ Changing Prefetchrows and Arraysize for Re-executed Statements
279279
In python-oracledb, the :attr:`~Cursor.prefetchrows` and
280280
:attr:`~Cursor.arraysize` values are only examined when a statement is executed
281281
the first time. To change the values for a re-executed statement, create a new
282-
cursor. For example, to change :attr:`~Cursor.arraysize``:
282+
cursor. For example, to change :attr:`~Cursor.arraysize`:
283283

284284
.. code-block:: python
285285

src/oracledb/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,9 @@ def sdu(self) -> int:
649649
(SDU) that is being used by the connection. The value will be the
650650
lesser of the requested python-oracledb size and the maximum size
651651
allowed by the database network configuration. It is available only in
652-
python-oracledb Thin mode.
652+
python-oracledb Thin mode. To set the SDU in Thick mode, use a
653+
connection string SDU parameter or set a value for DEFAULT_SDU_SIZE in
654+
a sqlnet.ora configuration file.
653655
"""
654656
self._verify_connected()
655657
return self._impl.get_sdu()

utils/templates/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,9 @@ def sdu(self) -> int:
647647
(SDU) that is being used by the connection. The value will be the
648648
lesser of the requested python-oracledb size and the maximum size
649649
allowed by the database network configuration. It is available only in
650-
python-oracledb Thin mode.
650+
python-oracledb Thin mode. To set the SDU in Thick mode, use a
651+
connection string SDU parameter or set a value for DEFAULT_SDU_SIZE in
652+
a sqlnet.ora configuration file.
651653
"""
652654
self._verify_connected()
653655
return self._impl.get_sdu()

0 commit comments

Comments
 (0)