Code Monkey home page Code Monkey logo

python-cx_oracle's Introduction

Open Source Python/Oracle Utility - cx_Oracle

cx_Oracle is a Python extension module that enables access to Oracle Database and conforms to the Python database API 2.0 specifications with a considerable number of additions and a couple of exclusions. The time data type is not supported by Oracle and is therefore not implemented. The method cursor.nextset() is not implemented either as the DB API specification assumes an implementation of cursors that does not fit well with Oracle's implementation of cursors and implicit results. See the method cursor.getimplicitresults() for more information.

See PEP 249 for more information on the Python database API specification. See the documentation for a complete description of the module's capabilities.

cx_Oracle is licensed under a BSD license which you can find here.

cx_Oracle has been tested with Python version 2.7, and with versions 3.4 and higher. You can use cx_Oracle with Oracle 11.2, 12.1 and 12.2 client libraries, allowing connection to multiple Oracle Database versions. Oracle's standard client-server version interoperability allows connection to both older and newer databases, for example Oracle 11.2 client libraries can connect to Oracle Database 10.2 or later.

Please note that an Oracle client (or server) installation is required in order to use cx_Oracle. If you do not require the tools that come with a full client installation, it is recommended to install the Instant Client. which is far easier to install.

Help

Issues and questions can be raised with the cx_Oracle community on GitHub or on the mailing list.

Installation

Binaries for some platforms are available at PyPI. If you prefer to build your own you can use this command

python -m pip install cx_Oracle

which will download the source package, build and install it. Otherwise, you can download the source package directly from PyPI, extract it and run these commands instead

python setup.py build
python setup.py install

This module is built with ODPI-C which supports versions 11.2, 12.1 and 12.2 of the Oracle Client libraries on Linux, Windows and macOS. Others have reported success with other platforms.

Usage Example

from __future__ import print_function   # needed for Python 2.x

import cx_Oracle

# connect via SQL*Net string or by each segment in a separate argument
#connection = cx_Oracle.connect("user/password@TNS")
connection = cx_Oracle.connect("user", "password", "TNS")

cursor = connection.cursor()
cursor.execute("""
        select Col1, Col2, Col3
        from SomeTable
        where Col4 = :arg_1
          and Col5 between :arg_2 and :arg_3""",
        arg_1 = "VALUE",
        arg_2 = 5,
        arg_3 = 15)
for column_1, column_2, column_3 in cursor:
    print("Values:", column_1, column_2, column_3)

For more examples, please see the test suite in the test directory and the samples in the samples directory. You can also look at the scripts in the cx_OracleTools and the modules in the cx_PyOracleLib projects.

python-cx_oracle's People

Contributors

anthony-tuininga avatar shaib avatar glenwalker avatar jakobgurn avatar hoops avatar ddriddle avatar rickeylev avatar

Watchers

James Cloos avatar songz avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.