Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the successor to cx_Oracle, which is now obsolete.

License

NotificationsYou must be signed in to change notification settings

oracle/python-oracledb

Repository files navigation

Python-oracledb is an open-sourcePython extension module allowingPython programs to connect toOracle Database. The module conformsto thePython Database API 2.0 specification with a considerablenumber of additions and a couple of minor exclusions, see thefeaturelist. It is maintained by Oracle.

Python-oracledb is used for executing SQL and PL/SQL; for calling NoSQL-styledocument APIs; for working with data frames; for receiving databasenotifications and messages; and for starting and stopping the database. It hasfeatures for high availability and security. It is used by many PythonFrameworks, SQL Generators, ORMs, and libraries.

Synchronous andconcurrent coding styles are supported. Databaseoperations can optionally bepipelined.

Python-oracledb is the successor to the now obsolete cx_Oracle driver.

Python-oracledb Installation

Run:

python -m pip install oracledb --upgrade

Seepython-oracledb Installation for details.

Samples

Examples can be found in the/samples directory and thePython and Oracle Database Tutorial.

A basic example:

import oracledbimport getpassun = "scott"cs = "localhost/orclpdb"# cs = "localhost/freepdb1"   # for Oracle Database Free users# cs = "localhost/orclpdb1"   # some databases may have this servicepw = getpass.getpass(f"Enter password for {un}@{cs}: ")with oracledb.connect(user=un, password=pw, dsn=cs) as connection:    with connection.cursor() as cursor:        sql = "select sysdate from dual"        for r in cursor.execute(sql):            print(r)

Dependencies and Interoperability

  • Python versions 3.9 through 3.13.

    Pre-built packages are available onPyPI and other repositories.

    Source code is also available.

    Previous versions of python-oracledb supported older Python versions.

  • Oracle Client libraries areoptional.

    Thin mode: By default python-oracledb runs in a 'Thin' mode whichconnects directly to Oracle Database.

    Thick mode: Some advanced Oracle Database functionality is currently onlyavailable when optional Oracle Client libraries are loaded bypython-oracledb. Libraries are available in the freeOracle InstantClient packages. Python-oracledb can use Oracle Clientlibraries 11.2 through 23ai.

  • Oracle Database

    Thin mode: Oracle Database 12.1 (or later) is required.

    Thick mode: Oracle Database 9.2 (or later) is required, depending on theOracle Client library version. Oracle Database's standard client-serverversion interoperability allows connection to both older and newerdatabases. For example when python-oracledb uses Oracle Client 19c libraries,then it can connect to Oracle Database 11.2 or later.

Documentation

See thepython-oracledb Documentation andReleaseNotes.

Help

Questions can be asked inGitHub Discussions.

Problem reports can be raised inGitHub Issues.

Tests

See/tests

Contributing

This project welcomes contributions from the community. Before submitting apull request, pleasereview our contribution guide.

Security

Please consult thesecurity guide for our responsible securityvulnerability disclosure process.

License

SeeLICENSE,THIRD_PARTY_LICENSES, andNOTICE.

About

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the successor to cx_Oracle, which is now obsolete.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp