A Celebration of Python and Oracle Database

Christopher Jones
5 min readJun 4, 2024

--

Python has been able to connect to Oracle Database for decades. Over that time, there have been several key, defining moments. The most recent was at the end of May 2022 when the Oracle Database driver was renamed from cx_Oracle to python-oracledb and became ‘Thin’, removing the need to install Oracle Client libraries. This was Oracle’s first open source driver that directly used Oracle Database’s network protocol, making it not only a significant release for users, but also marking a significant milestone in the history of Oracle.

A timeline of key driver moments: started in 1999 by Anthony Tuininga, Oracle began contributing in 2014. By 2016 we had hired Anthony. In 2017 cx_Oracle was refactored to use ODPI-C, letting the Oracle clients be plugged-and-played. In 2022 python-oracledb with its Thin mode was released. In 2024, Oracle Database 23ai became generally available.

For the two-year birthday, this blog post celebrates what’s happened since that first release of python-oracledb. A big shout out to our development team, and to the community members, who have contributed to its continued success. As your Python projects have adopted python-oracledb, we’ve see a steady growth in downloads and it has overtaken cx_Oracle’s already stellar popularity.

WHAT’S NEW SINCE 2022

Since 2022, we’ve made twenty-two releases to date (June 2024), keeping up a fast rate of improvements. Features were added, bugs were squashed, performance improved, stability improved, test coverage increased, and documentation enhanced.

The feature-release highlights are below. See the release notes for all the smaller features and all the other improvements that landed.

python-oracledb 1.0.0

The first python-oracledb release was on 26th May 2022. Its new, default ‘Thin’ mode immediately resonated with users due to its small size, and the fact that it didn’t need Oracle Client libraries (e.g. Oracle Instant Client) installed. It had all the functionality needed to support the Python Database API v2.0 Specification (except for a few exceptions due to database differences) — this lets it be used in frameworks, SQL Generators and other libraries. For those that need it, the driver’s optional ‘Thick’ mode can be enabled at runtime to provide functionality equivalent to cx_Oracle, making use of all the goodies provided by Oracle Client libraries.

Along with functionality to make using Thin mode easy, we also introduced a new two-phase commit API for ‘Thick’ mode python-oracledb.

We took the decision to rename the driver, but don’t be confused. It really is just cx_Oracle with new capabilities. My original release post Open Source Python Thin Driver for Oracle Database covers the significant improvements in python-oracledb 1.0 over cx_Oracle 8.3. Also see the Upgrading documentation.

python-oracledb 1.1.0

Some Advanced Queuing (AQ) updates landed, including support for JSON payloads. Also arriving was support for Azure Active Directory OAuth 2.0 and Oracle Cloud Infrastructure Identity and Access Management (IAM) token authentication to Oracle Autonomous Database.

See the release announcement and release notes.

python-oracledb 1.2.0

Binding and fetching of Database Objects was added to Thin mode — this turns out to be be much faster than the Thick mode implementation. For XMLTYPE columns, Thin mode improvements allow data to be fetched fully without needing the query to be modified to call XMLTYPE.GETCLOBVAL(). Binary packages for the new Python 3.11 were released.

See the release announcement and release notes.

python-oracledb 1.3.0

Thin mode can now bind and query the Oracle Database 21c JSON data type. Connection Pool improvements in Thin mode allow pools to shrink, if desired. Some features to support early adopters of what will be eventually released as Oracle Database 23ai landed, including support for the new SQL BOOLEAN datatype, and support for longer passwords. Overall, this was a big release with many bug fixes and tidy-ups.

See the release announcement and release notes.

python-oracledb 1.4.0

This release saw further work to Thin mode connection management and behavior, particularly for connection pooling. Support for SODA indexes and locking landed. A new column metadata object for query cursors was introduced, giving more flexibility for the driver to give column information.

See the release announcement and release notes.

python-oracledb 1.4.2

This small bug fix release followed soon after Python 3.12 was shipped, so python-oracledb binary packages for Python 3.12 were released.

python-oracledb 2.0.0

As befitting a major version number bump, this release of python-oracledb saw the introduction of a major feature: support for concurrent programming using Python’s asyncio package. In other news, password expiry and PL/SQL “success with information” warnings can be displayed. New database attributes make is easier to set or get information about the database, such as for tuning the network SDU, and for showing whether a transaction is in progress on a connection. Support for the obsolete Python 3.6 is dropped.

See the release announcement and release notes.

python-oracledb 2.1.0

This was yet-another big release. More features for Oracle Database 23ai landed: reduction of time to create connections, and Implicit Connection Pooling (useful for applications that cause excess database server load due to the number of standalone connections opened). Support for TCP Fast Open landed. SODA improvements allow use of extended JSON data types.

See the release announcement and release notes.

python-oracledb 2.2.0

Oracle Database 23ai recently became Generally Available and the python-oracledb 2.2 release was made in parallel. It has support for the new VECTOR data type, paving the way for Oracle Database to be used for Generative AI. Support for INTERVAL YEAR TO MONTH data type was added. Also support for IFILE in tnsnames.ora files and support for iterating over python-oracledb DbObjects that are collections arrived.

See the release announcement and release notes.

python-oracledb 2.3.0 (not yet released)

Although python-oracledb 2.3.0 is not yet released as a package, work is ongoing. Already in the code base on GitHub is support for two-phase commits in Thin mode (bringing it up to par with Thick mode).

What else will land?! Stay tuned.

Installing or Upgrading python-oracledb

You can install or upgrade python-oracledb by running:

python -m pip install oracledb --upgrade

The pip options --proxy and --user may be useful in some environments. See python-oracledb Installation for details.

Python-oracledb References

Home page: oracle.github.io/python-oracledb/index.html

Installation instructions: python-oracledb.readthedocs.io/en/latest/installation.html

Documentation: python-oracledb.readthedocs.io/en/latest/index.html

Release Notes: python-oracledb.readthedocs.io/en/latest/release_notes.html

Discussions: github.com/oracle/python-oracledb/discussions

Issues: github.com/oracle/python-oracledb/issues

Source Code Repository: github.com/oracle/python-oracledb

--

--

Christopher Jones

Oracle Database Product Manager for language drivers including Python python-oracledb, Node.js node-oracledb, PHP OCI8 and more! On Mastodon: @cjbj@phpc.social