Python interface to Oracle Database
Actively maintained. Last release 6 days ago, commits in 20 of the last 26 weeks. A safe choice.
pip install oracledbpython-oracledb
The python-oracledb driver is the widely used, open-source Python extension module allowing Python programs to connect directly to Oracle Database with no extra libraries needed. The module is built with Cython for safety and speed. It is lightweight and high-performance. It is stable, well tested, and has comprehensive documentation. The module is maintained by Oracle.
The module conforms to the Python Database API 2.0 specification with a considerable number of additions and a couple of minor exclusions, see the feature list. It is used by many Python frameworks, SQL generators, ORMs, and libraries.
Python-oracledb has a rich feature set which is easy to use. It gives you control over SQL and PL/SQL statement execution; for working with data frames; for fast data ingestion; for calling NoSQL-style document APIs; for message queueing; for receiving database notifications; and for starting and stopping the database. It also has high availability and security features. Synchronous and concurrent coding styles are supported. Database operations can optionally be pipelined.
Python-oracledb is the successor to the now obsolete cx_Oracle driver.
Python-oracledb Installation
Run:
python -m pip install oracledb --upgrade
See Installing python-oracledb for details.
To enable the optional embedded OpenTelemetry plugin, install:
python -m pip install "oracledb[opentelemetry]"
Then explicitly enable it with from oracledb.plugins import opentelemetry
followed by opentelemetry.instrument(). Installing this dependency alone
does not change application behavior. Install opentelemetry-sdk and an
exporter to record and export spans and metrics. The plugin emits the
db.client.operation.duration metric when the application configures an
OpenTelemetry MeterProvider. Do not enable this plugin with another Oracle
Database or DBAPI OpenTelemetry instrumentation, including
or
, in the same process.