Oracle

Oracle Database is an enterprise relational database. It can run transaction processing, data warehousing, and multi-model database workloads such as machine learning, spatial, and graph analysis. Recent versions of Oracle Database also added support for JSON and blockchain use cases, and the software can be run in on-premise, cloud or hybrid environments.

Oracle logo.

How does Oracle fit with Python?

The Python community and Oracle have a long history. The excellent Python Database API-compliant "cx_Oracle" interface for Oracle Database was first created by the user community in 1998 and is now being enhanced and maintained by Oracle. The cx_Oracle module also underpins the Oracle Machine Learning for Python engine. Oracle's high-performance GraalVM framework supports an implementation of Python called GraalPython.

Why is Oracle Database a great choice?

Oracle Database is cross-platform, supporting multiple hardware platforms and various operating systems. Developers and companies of all sizes rely on its proven industry-leading performance, scalability, reliability, and security. As data volumes rise exponentially, new data types and data models are required to support modern applications. Oracle Database supports the following data types at no extra cost:

With support for scale-out database clusters, sharded distributed systems, and disaster recovery with continuous application availability, there is no shortage of features to guarantee the Database continues to run uninterrupted 24/7.

Oracle makes its enterprise-class database readily available to developers with its free on-premises edition Oracle Database XE or on the Oracle public cloud with an Always Free Cloud account. In addition, Oracle Autonomous Database is a popular choice for developers as no database management or tuning is required, leaving developers to do what they do best – writing code for their applications.

Connecting to Oracle Database with Python

As with any database, applications require a connector or driver to connect to the Oracle Database. The Python DB API-compliant cx_Oracle interface provides developers access to standard and advanced Oracle Database features, such as SQL execution and document storage APIs. It also gives users access to network traffic encryption capabilities and Oracle's leading high availability features.

Code examples and free workshops such as the introductory Python and Oracle for Developers Workshop and a full-stack development workshop using Python with SQLAlchemy to Oracle Database are available.

cx Oracle driver.

You can use many Python frameworks and object-relational mappers (ORMs) with Oracle Database. ORMs abstract the tables and objects in a relational database to objects that Python developers can manipulate and operate on. SQLAlchemy and Django are popular ORMs. SQLAlchemy is used by Pandas, which is very popular with Oracle users. The table below shows the relationship between web framework, ORM, driver, and the Oracle Database.

Examples of how varying Python ORMs can work with Oracle and the cx Oracle connector.

Learn more about Python ORMs on that dedicated topic page.

ORMs provide a familiar programming model for Python developers, but sometimes you want that extra performance and operate closer to SQL objects. Oracle cx_Oracle offers several functions to deliver that performance. These functions include fetching data, binding data, executing PL/SQL, operating on LOBs, JSON documents, message passing with Oracle Advanced Queuing, and more.

Oracle and Data Safety

According to Gartner, Oracle has one of the highest data safety ratings in the industry, with a wide range of features for data protection and high availability. These features include:

Oracle also provides numerous data recovery features, including:

For an overview of Oracle’s security and high availability architecture, see the following white papers:

Python Specific Oracle Database resources

Many quick starts, tutorials, and workshops exist specifically for Python developers using Oracle Database. Below are some of the best ones to start with.

Getting Started

If you are looking for a fast way to get started with Python and Oracle Database, check out these two quick start tutorials. These tutorials walk you through installing and setting up the environment you need to connect Python to Oracle Database.

Once you have done one of these, then continue with the popular Python and Oracle Database Tutorial: Scripting for the Future to dive deeper to master the Python cx_Oracle interface and see how to build great Oracle Database applications.

Using Different Frameworks with Oracle

Workshops

The following hands-on, free workshops provide step-by-step instructions and walkthroughs in a live environment.

  • Use Python with Oracle Database 19c is an Oracle LiveLabs workshop that shows how to write Python code to connect to and read data from an Oracle Database, including JSON data.

  • Python and Oracle for Developers is an Oracle LiveLabs workshop that explores the features of the Python cx_Oracle interface for Oracle Database, including efficient techniques for connection management and statement handling.

  • Full Stack Development using Python and deployment via OKE is an Oracle LiveLabs workshop that explores how to build and deploy a simple cloud-native application using the most common frameworks and the Oracle Cloud Infrastructure services.

Cloud Development with Oracle Database

The following resources are good starting points for those looking to build applications in the Oracle Cloud and deploy applications in Docker containers and Kubernetes.

For developers looking to focus on application development in the Oracle Cloud and not have to worry about managing the Oracle Database, the Autonomous Database is a good choice. All management, including patching and upgrades, scalability, and security, are entirely autonomous. The following resources offer you a glimpse of its capabilities.

General Oracle Database Resources

Here are some Oracle tutorials and resources not specific to Python that can help you take advantage of the Oracle Database features.

What's next to get your app running?

What're these NoSQL data stores hipster developers keep talking about?

My app runs but looks awful. How do I style the user interface?

How do I use JavaScript with my Python web application?


Matt Makai 2012-2022