Skip to content

Commit c76492e

Browse files
Documentation improvements.
1 parent 9c9b92a commit c76492e

File tree

5 files changed

+65
-5
lines changed

5 files changed

+65
-5
lines changed

doc/src/api_manual/soda.rst

+37-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,47 @@ SODA
99
allows documents to be inserted, queried, and retrieved from Oracle Database
1010
using a set of NoSQL-style cx_Oracle methods.
1111

12-
See :ref:`sodausermanual` for a cx_Oracle example.
12+
See :ref:`user manual <sodausermanual>` for an example.
1313

1414
SODA requires Oracle Client 18.3 or higher and Oracle Database 18.1 and higher.
1515
The role SODA_APP must be granted to the user.
1616

17-
See
18-
`this tracking issue <https://github.com/oracle/python-cx_Oracle/issues/309>`__ for known issues with SODA.
17+
.. note::
18+
19+
If you are using Oracle Database 21c (or later) and create new collections
20+
you need to do one of the following:
21+
22+
- Use Oracle Client libraries 21c (or later).
23+
24+
- Or, explicitly use collection metadata when creating collections and set
25+
the data storage type to BLOB, for example::
26+
27+
{
28+
"keyColumn": {
29+
"name":"ID"
30+
},
31+
"contentColumn": {
32+
"name": "JSON_DOCUMENT",
33+
"sqlType": "BLOB"
34+
},
35+
"versionColumn": {
36+
"name": "VERSION",
37+
"method": "UUID"
38+
},
39+
"lastModifiedColumn": {
40+
"name": "LAST_MODIFIED"
41+
},
42+
"creationTimeColumn": {
43+
"name": "CREATED_ON"
44+
}
45+
}
46+
47+
- Or, set the database initialization parameter `compatible
48+
<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&
49+
id=GUID-A2E90F08-BC9F-4688-A9D0-4A948DD3F7A9>`__ to 19 or lower.
50+
51+
Otherwise you may get errors such as "ORA-40659: Data type does not match
52+
the specification in the collection metadata".
1953

2054
.. _sodadb:
2155

doc/src/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ API Manual
5656
api_manual/lob.rst
5757
api_manual/object_type.rst
5858
api_manual/aq.rst
59-
Soda Document Class <api_manual/soda.rst>
59+
api_manual/soda.rst
6060

6161

6262
Indices and tables

doc/src/user_guide/bind.rst

+2
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ return type of :meth:`Cursor.callfunc()`:
278278
for row in refCursor:
279279
print(row)
280280
281+
See :ref:`tuning` for information on how to tune REF CURSORS.
282+
281283
Binding PL/SQL Collections
282284
==========================
283285

doc/src/user_guide/initialization.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,6 @@ not specified, then the value "cx_Oracle : *version*" is used.
382382

383383
The ``error_url`` string will be shown in the exception raised if
384384
``init_oracle_client()`` cannot load the Oracle Client libraries. This allows
385-
applications that use node-oracledb to refer users to application-specific
385+
applications that use cx_Oracle to refer users to application-specific
386386
installation instructions. If this value is not specified, then the
387387
:ref:`installation` URL is used.

doc/src/user_guide/tuning.rst

+24
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,30 @@ data from one database to another:
214214
215215
.. _roundtrips:
216216

217+
Tuning REF CURSORS
218+
++++++++++++++++++
219+
220+
In cx_Oracle, REF CURSORS can also be tuned by setting the values of ``arraysize``
221+
and ``prefetchrows``. The prefetchrows value must be set before calling the PL/SQL
222+
procedure as the REF CURSOR is executed on the server.
223+
224+
For example:
225+
226+
.. code-block:: python
227+
228+
# Set the arraysize and prefetch rows of the REF cursor
229+
ref_cursor = connection.cursor()
230+
ref_cursor.prefetchrows = 1000
231+
ref_cursor.arraysize = 1000
232+
233+
# Perform the tuned fetch
234+
sum_rows = 0
235+
cursor.callproc("myrefcursorproc", [ref_cursor])
236+
print("Sum of IntCol for", num_rows, "rows:")
237+
for row in ref_cursor:
238+
sum_rows += row[0]
239+
print(sum_rows)
240+
217241
Database Round-trips
218242
====================
219243

0 commit comments

Comments
 (0)