cx_Oracle is an open source package for the Python Database API specification with many additions to support advanced Oracle Database features.
This is a major release that adds to cx_Oracle's great Oracle Database support. You can hear me talk about some of the new cx_Oracle 8 features in the June 2020 Python Office Hours recording. The release notes contain all the changes and improvements.
Particular thanks go to Alex Henrie for a series of code cleanups and small fixes.
Python 3 support: In line with the upstream Python community farewelling Python 2, this release of cx_Oracle only installs in Python 3. (If you have Python 2 then installing cx_Oracle will give you the older cx_Oracle 7.3). See the installation instructions.
New method for locating the Oracle Client libraries: A new cx_Oracle.init_oracle_client() function can optionally be used to configure the Oracle Client. For example, the location of the Oracle Client libraries can be passed to it. This is most useful on Windows and macOS - particularly with recent macOS changes restricting library access. There are some limitations on Linux. The function can also be passed the configuration file directory where your optional files like tnsnames.ora are. See cx_Oracle 8 Initialization.
Default character sets are UTF-8: The default encoding and national language encoding are now UTF-8. Importantly the character set component of the NLS_LANG environment variable is now ignored. To change the encodings use the encoding and nencoding parameters when creating standalone connections or connection pools. See Character Sets and Globalization.
New Cursor.prefetchrows attribute for query fetch tuning: You can use Cursor.prefetchrows in conjunction with the existing Cursor.arraysize value to tune the number of round-trips taken to fetch rows after a query is executed. Round-trips between cx_Oracle and Oracle Database have a significant impact on performance and overall system scalability. I talk more about this in the Office Hours recording. Also review the cx_Oracle tuning documentation.
Database type constant improvements: The database type constant names were rationalized and some types added. Synonyms were created for backward compatibility. See the release notes for details and other type changes.
If you're new to cx_Oracle, look at our cx_Oracle Tutorial. Recently some great work from the Oracle LiveLabs team has made it immediately runnable in Oracle Cloud. Check out their Oracle Cloud instructions.
Review the updated installation and configuration documentation, particuarly for macOS.
You can install or upgrade cx_Oracle by running:
python -m pip install cx_Oracle --upgrade
The pip options --force-reinstall, --proxy, and --user may be useful in some environments.
Home page: oracle.github.io/python-cx_Oracle/index.html
Installation instructions: cx-oracle.readthedocs.io/en/latest/installation.html
Release Notes: cx-oracle.readthedocs.io/en/latest/release_notes.html
Source Code Repository: github.com/oracle/python-cx_Oracle
Facebook group: www.facebook.com/groups/oraclescripting/