Skip to content

Commit d5aaff8

Browse files
Documntation updates.
1 parent 464ae4f commit d5aaff8

File tree

6 files changed

+146
-113
lines changed

6 files changed

+146
-113
lines changed

doc/src/api_manual/module.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,9 @@ Oracledb Methods
906906

907907
This method is an extension to the DB API definition.
908908

909+
.. versionadded:: 1.1.0
910+
911+
909912
.. function:: makedsn(host, port, sid=None, service_name=None, region=None, \
910913
sharding_key=None, super_sharding_key=None)
911914

doc/src/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ additions and a couple of exclusions.
1111
This module is currently tested with Python 3.6, 3.7, 3.8, 3.9, and 3.10
1212
against Oracle Database 21c, 19c, 18c, 12c, and 11.2.
1313

14-
Changes in python-oracledb releases can be found in the :ref:`release notes
15-
<releasenotes>`.
14+
**python-oracledb** is distributed under an open-source
15+
:ref:`license <license>`. Changes in python-oracledb releases can be found in
16+
the :ref:`release notes <releasenotes>`.
1617

1718
User Guide
1819
==========

doc/src/license.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ License
1010

1111
.. centered:: **LICENSE AGREEMENT FOR python-oracledb**
1212

13-
Copyright (c) 2016, 2022 Oracle and/or its affiliates.
13+
Copyright |copy| 2016, 2022 Oracle and/or its affiliates.
1414

1515
This software is dual-licensed to you under the Universal Permissive License
1616
(UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License

doc/src/user_guide/appendix_c.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ as follows:
144144
password is now supported in the same way as :func:`oracledb.connect()`. For
145145
example ``dsn="un/pw@cs"`` can be used.
146146

147+
- New keyword arguments can be passed to :func:`~oracledb.create_pool()`. For
148+
example you can pass the hostname, port and servicename as separate
149+
parameters instead of using an Easy Connect connection string. In
150+
python-oracledb Thin mode, some of the new arguments replace ``sqlnet.ora``
151+
settings.
152+
147153
- The default mode is :data:`~oracledb.POOL_GETMODE_WAIT` instead of
148154
:data:`~oracledb.POOL_GETMODE_NOWAIT`. If the mode
149155
:data:`~oracledb.POOL_GETMODE_NOWAIT` is truly desired, modify any pool
@@ -216,6 +222,14 @@ Replace:
216222
- :meth:`Connection.enq()` with :meth:`Queue.enqone()` or :meth:`Queue.enqmany()`
217223
- :meth:`Connection.deqoptions()` with attribute :attr:`Queue.deqoptions`
218224

225+
The AQ feature in the python-oracledb driver differs from cx_Oracle as follows:
226+
227+
- AQ messages can be enqueued and dequeued as a JSON payload type
228+
- Recipient lists can be enqueued and dequeued
229+
- Enqueue options, dequeue options, and message properties can be set
230+
231+
See :ref:`Oracle Advanced Queuing (AQ) <aqusermanual>`.
232+
219233
.. _errordiff:
220234

221235
Error Handling Differences from cx_Oracle

doc/src/user_guide/batch_statement.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _batchstmnt:
22

3-
******************************************
4-
Executing Batch Statement and Bulk Loading
5-
******************************************
3+
*******************************************
4+
Executing Batch Statements and Bulk Loading
5+
*******************************************
66

77
Inserting or updating multiple rows can be performed efficiently with
88
:meth:`Cursor.executemany()`, making it easy to work with large data sets with

doc/src/user_guide/initialization.rst

Lines changed: 122 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,19 @@ begins with ``python-oracledb thk``. See :ref:`vsessconinfo`.
5050

5151
.. _libinit:
5252

53-
Locating the Oracle Client Libraries
54-
------------------------------------
53+
Setting the Oracle Client Library Directory
54+
-------------------------------------------
5555

5656
When :meth:`~oracledb.init_oracle_client()` is called, python-oracledb
5757
dynamically loads Oracle Client libraries using a search heuristic. Only the
58-
first set of libraries found are loaded. The libraries can be in an
59-
installation of Oracle Instant Client, in a full Oracle Client installation, or
60-
in an Oracle Database installation (if Python is running on the same machine as
61-
the database). The versions of Oracle Client and Oracle Database do not have
58+
first set of libraries found are loaded. The libraries can be:
59+
60+
- in an installation of Oracle Instant Client
61+
- or in a full Oracle Client installation
62+
- or in an Oracle Database installation (if Python is running on the same
63+
machine as the database).
64+
65+
The versions of Oracle Client and Oracle Database do not have
6266
to be the same. For certified configurations see Oracle Support's `Doc ID
6367
207303.1
6468
<https://support.oracle.com/epmos/faces/DocumentDisplay?id=207303.1>`__.
@@ -68,150 +72,151 @@ libraries.
6872

6973
.. _wininit:
7074

71-
* On Windows, python-oracledb Thick mode can be enabled as follows:
75+
Setting the Oracle Client Directory on Windows
76+
++++++++++++++++++++++++++++++++++++++++++++++
7277

73-
- By passing the ``lib_dir`` parameter in a call to
74-
:meth:`~oracledb.init_oracle_client()`, for example:
78+
On Windows, python-oracledb Thick mode can be enabled as follows:
7579

76-
.. code-block:: python
80+
- By passing the ``lib_dir`` parameter in a call to
81+
:meth:`~oracledb.init_oracle_client()`, for example:
7782

78-
import oracledb
83+
.. code-block:: python
7984
80-
oracledb.init_oracle_client(lib_dir=r"C:\instantclient_19_14")
85+
import oracledb
8186
82-
This directory should contain the libraries from an unzipped Instant
83-
Client 'Basic' or 'Basic Light' package. If you pass the library
84-
directory from a full client or database installation, such as Oracle
85-
Database "XE" Express Edition, then you will need to have previously set
86-
your environment to use that same software installation. Otherwise, files
87-
such as message files will not be located and you may have library
88-
version clashes. On Windows, when the path contains backslashes, use a
89-
'raw' string like ``r"C:\instantclient_19_14"``.
87+
oracledb.init_oracle_client(lib_dir=r"C:\instantclient_19_14")
9088
91-
If the Oracle Client libraries cannot be loaded from ``lib_dir``, then an
92-
exception is raised.
89+
This directory should contain the libraries from an unzipped Instant
90+
Client 'Basic' or 'Basic Light' package. If you pass the library
91+
directory from a full client or database installation, such as Oracle
92+
Database "XE" Express Edition, then you will need to have previously set
93+
your environment to use that same software installation. Otherwise, files
94+
such as message files will not be located and you may have library
95+
version clashes. On Windows, when the path contains backslashes, use a
96+
'raw' string like ``r"C:\instantclient_19_14"``.
9397

94-
- By calling :meth:`~oracledb.init_oracle_client()` without passing a
95-
``lib_dir`` parameter:
98+
If the Oracle Client libraries cannot be loaded from ``lib_dir``, then an
99+
exception is raised.
96100

97-
.. code-block:: python
101+
- By calling :meth:`~oracledb.init_oracle_client()` without passing a
102+
``lib_dir`` parameter:
98103

99-
import oracledb
104+
.. code-block:: python
100105
101-
oracledb.init_oracle_client()
106+
import oracledb
107+
108+
oracledb.init_oracle_client()
102109
103-
In this case, Oracle Client libraries are first looked for in the
104-
directory where the python-oracledb binary module is installed. This
105-
directory should contain the libraries from an unzipped Instant Client
106-
'Basic' or 'Basic Light' package.
110+
In this case, Oracle Client libraries are first looked for in the
111+
directory where the python-oracledb binary module is installed. This
112+
directory should contain the libraries from an unzipped Instant Client
113+
'Basic' or 'Basic Light' package.
107114

108-
If the libraries are not found there, the search looks at the directories
109-
on the system library search path, for example, the ``PATH`` environment
110-
variable.
115+
If the libraries are not found there, the search looks at the directories
116+
on the system library search path, for example, the ``PATH`` environment
117+
variable.
111118

112-
If the Oracle Client libraries cannot be loaded, then an exception is
113-
raised.
119+
If the Oracle Client libraries cannot be loaded, then an exception is
120+
raised.
114121

115122
.. _macinit:
116123

117-
* On macOS, python-oracledb Thick mode can be enabled as follows:
124+
Setting the Oracle Client Directory on macOS
125+
++++++++++++++++++++++++++++++++++++++++++++
118126

119-
- By passing the ``lib_dir`` parameter in a call to
120-
:meth:`~oracledb.init_oracle_client()`, for example:
127+
On macOS, python-oracledb Thick mode can be enabled as follows:
121128

122-
.. code-block:: python
129+
- By passing the ``lib_dir`` parameter in a call to
130+
:meth:`~oracledb.init_oracle_client()`, for example:
123131

124-
import oracledb
132+
.. code-block:: python
125133
126-
oracledb.init_oracle_client(lib_dir="/Users/your_username/Downloads/instantclient_19_8")
134+
import oracledb
127135
128-
This directory should contain the libraries from an unzipped Instant
129-
Client 'Basic' or 'Basic Light' package. If the Oracle Client libraries
130-
cannot be loaded from ``lib_dir``, then an exception is raised.
136+
oracledb.init_oracle_client(lib_dir="/Users/your_username/Downloads/instantclient_19_8")
131137
132-
- By calling :meth:`~oracledb.init_oracle_client()` without passing a
133-
``lib_dir`` parameter:
138+
This directory should contain the libraries from an unzipped Instant
139+
Client 'Basic' or 'Basic Light' package. If the Oracle Client libraries
140+
cannot be loaded from ``lib_dir``, then an exception is raised.
141+
142+
- By calling :meth:`~oracledb.init_oracle_client()` without passing a
143+
``lib_dir`` parameter:
134144

135145
.. code-block:: python
136146
137147
import oracledb
138148
139149
oracledb.init_oracle_client()
140150
141-
In this case, the Oracle Client libraries are first looked for in the
142-
directory where the python-oracledb Thick mode binary module is installed.
143-
This directory should contain the libraries from an unzipped Instant Client
144-
'Basic' or 'Basic Light' package, or a symbolic link to the main Oracle
145-
Client library if Instant Client is in a different directory.
146-
147-
You can find the directory containing the Thick mode binary module by
148-
calling the python CLI without specifying a Python script, executing
149-
``import oracledb``, and then typing ``oracledb`` at the prompt. For
150-
example if
151-
``/Users/yourname/Library/3.9.6/lib/python3.9/site-packages/oracledb-1.0.0-py3.9-macosx-11.5-x86_64.egg/oracledb``
152-
contains ``thick_impl.cpython-39-darwin.so``, then you could run ``ln -s
153-
~/Downloads/instantclient_19_8/libclntsh.dylib
154-
~/Library/3.9.6/lib/python3.9/site-packages/oracledb-1.0.0-py3.9-macosx-11.5-x86_64.egg/oracledb/``.
155-
156-
If python-oracledb does not find the Oracle Client library in that
157-
directory, the directories on the system library search path may be used,
158-
for example, ``~/lib/`` and ``/usr/local/lib``, or in ``$DYLD_LIBRARY_PATH``.
159-
These paths will vary with macOS version and Python version. Any value
160-
in ``DYLD_LIBRARY_PATH`` will not propagate to a sub-shell.
161-
162-
If the Oracle Client libraries cannot be loaded, then an exception is
163-
raised.
151+
In this case, the Oracle Client libraries are first looked for in the
152+
directory where the python-oracledb Thick mode binary module is installed.
153+
This directory should contain the libraries from an unzipped Instant Client
154+
'Basic' or 'Basic Light' package, or a symbolic link to the main Oracle
155+
Client library if Instant Client is in a different directory.
156+
157+
You can find the directory containing the Thick mode binary module by
158+
calling the python CLI without specifying a Python script, executing
159+
``import oracledb``, and then typing ``oracledb`` at the prompt. For
160+
example if
161+
``/Users/yourname/Library/3.9.6/lib/python3.9/site-packages/oracledb-1.0.0-py3.9-macosx-11.5-x86_64.egg/oracledb``
162+
contains ``thick_impl.cpython-39-darwin.so``, then you could run ``ln -s
163+
~/Downloads/instantclient_19_8/libclntsh.dylib
164+
~/Library/3.9.6/lib/python3.9/site-packages/oracledb-1.0.0-py3.9-macosx-11.5-x86_64.egg/oracledb/``.
165+
166+
If python-oracledb does not find the Oracle Client library in that
167+
directory, the directories on the system library search path may be used,
168+
for example, ``~/lib/`` and ``/usr/local/lib``, or in ``$DYLD_LIBRARY_PATH``.
169+
These paths will vary with macOS version and Python version. Any value
170+
in ``DYLD_LIBRARY_PATH`` will not propagate to a sub-shell.
171+
172+
If the Oracle Client libraries cannot be loaded, then an exception is
173+
raised.
164174

165175
.. _linuxinit:
166176

167-
* On Linux and related platforms, python-oracledb Thick mode can be enabled as
168-
follows:
177+
Setting the Oracle Client Directory on Linux and Related Platforms
178+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
169179

170-
- By calling :meth:`~oracledb.init_oracle_client()` without passing a
171-
``lib_dir`` parameter:
180+
On Linux and related platforms, python-oracledb Thick mode can be enabled as
181+
follows:
172182

173-
.. code-block:: python
183+
- By calling :meth:`~oracledb.init_oracle_client()` without passing a
184+
``lib_dir`` parameter:
174185

175-
import oracledb
186+
.. code-block:: python
176187
177-
oracledb.init_oracle_client()
188+
import oracledb
178189
179-
Oracle Client libraries are looked for in the operating system library
180-
search path, such as configured with ``ldconfig`` or set in the environment
181-
variable ``LD_LIBRARY_PATH``. On some UNIX platforms an OS specific
182-
equivalent, such as ``LIBPATH`` or ``SHLIB_PATH`` is used instead of
183-
``LD_LIBRARY_PATH``.
184-
185-
If libraries are not found in the system library search path, then
186-
``$ORACLE_HOME/lib`` will be used. Note that the environment variable
187-
``ORACLE_HOME`` should only ever be set when you have a full database
188-
installation or full client installation (such as installed with the Oracle
189-
GUI installer). It should not be set if you are using Oracle Instant
190-
Client. The ``ORACLE_HOME`` variable, and other necessary variables, should
191-
be set before starting Python. See :ref:`envset`.
192-
193-
If the Oracle Client libraries cannot be loaded, then an exception is
194-
raised.
195-
196-
Ensure that the Python process has directory and file access permissions for the
197-
Oracle Client libraries. On Linux ensure a ``libclntsh.so`` file exists. On
198-
macOS ensure a ``libclntsh.dylib`` file exists. python-oracledb Thick will not directly
199-
load ``libclntsh.*.XX.1`` files in ``lib_dir`` or from the directory where the
200-
python-oracledb binary module is available. Note that other libraries used by
201-
``libclntsh*`` are also required.
190+
oracledb.init_oracle_client()
202191
203-
To trace the loading of Oracle Client libraries, the environment variable
204-
``DPI_DEBUG_LEVEL`` can be set to 64 before starting Python. For example, on
205-
Linux, you might use::
192+
Oracle Client libraries are looked for in the operating system library
193+
search path, such as configured with ``ldconfig`` or set in the environment
194+
variable ``LD_LIBRARY_PATH``. On some UNIX platforms an OS specific
195+
equivalent, such as ``LIBPATH`` or ``SHLIB_PATH`` is used instead of
196+
``LD_LIBRARY_PATH``.
206197

207-
$ export DPI_DEBUG_LEVEL=64
208-
$ python myapp.py 2> log.txt
198+
If libraries are not found in the system library search path, then
199+
``$ORACLE_HOME/lib`` will be used. Note that the environment variable
200+
``ORACLE_HOME`` should only ever be set when you have a full database
201+
installation or full client installation (such as installed with the Oracle
202+
GUI installer). It should not be set if you are using Oracle Instant
203+
Client. The ``ORACLE_HOME`` variable, and other necessary variables, should
204+
be set before starting Python. See :ref:`envset`.
209205

206+
If the Oracle Client libraries cannot be loaded, then an exception is
207+
raised.
208+
209+
Ensure that the Python process has directory and file access permissions for
210+
the Oracle Client libraries. On Linux ensure a ``libclntsh.so`` file exists.
211+
On macOS ensure a ``libclntsh.dylib`` file exists. python-oracledb Thick will
212+
not directly load ``libclntsh.*.XX.1`` files in ``lib_dir`` or from the directory
213+
where the python-oracledb binary module is available. Note that other libraries
214+
used by ``libclntsh*`` are also required.
210215

211216
.. _usinginitoracleclient:
212217

213-
Using oracledb.init_oracle_client() to set the Oracle Client directory
214-
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
218+
Calling oracledb.init_oracle_client() to Set the Oracle Client Directory
219+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
215220

216221
Oracle Client Libraries are loaded when :meth:`oracledb.init_oracle_client()`
217222
is called. In some environments, applications can use the ``lib_dir``
@@ -250,6 +255,16 @@ variable. Otherwise, you will get errors like ``ORA-1804``. You should set thi
250255
along with other Oracle environment variables before starting Python as
251256
shown in :ref:`envset`.
252257

258+
**Tracing Oracle Client Libraries Loading**
259+
260+
To trace the loading of Oracle Client libraries, the environment variable
261+
``DPI_DEBUG_LEVEL`` can be set to 64 before starting Python. For example, on
262+
Linux, you might use::
263+
264+
$ export DPI_DEBUG_LEVEL=64
265+
$ python myapp.py 2> log.txt
266+
267+
253268
.. _optnetfiles:
254269

255270
Optional Oracle Net Configuration Files

0 commit comments

Comments
 (0)