Skip to main content

Python interface to ODBC

Project description

Open Source Python/ODBC Utility - ceODBC

ceODBC is a Python extension module that enables access to databases using the ODBC API and conforms to the Python database API 2.0 specifications with a number of additions. Python 3.7 and higher is required as of version 3.1.

See https://www.python.org/dev/peps/pep-0249 for more information on the Python database API specification.

For feedback or patches, please use GitHub issues: https://github.com/anthony-tuininga/ceODBC/issues

Installation

python -m pip install ceODBC --upgrade

Add the --user option if you do not have system access. Binaries are available for Linux and Windows as a convenience.

Usage Example

Note that the DSN in the example below should be replaced with an appropriate string that ODBC understands. For example, if a system DSN called "MYDATA" has been created in the ODBC manager, use "DSN=MYDATA" to connect. For what is termed DSN-less connections, search the Internet for appropriate strings.

import ceODBC

connection = ceODBC.connect(DSN)

cursor = connection.cursor()
cursor.execute("""
        select Col1, Col2, Col3
        from SomeTable
        where Col4 = ?
          and Col5 between ? and ?""",
        ["VALUE", 5, 10])
for column_1, column_2, column_3 in cursor:
    print("Values:", column_1, column_2, column_3)

Notes

If your driver is not capable of transactions (often indicated by the exception "driver not capable" when connecting) then use the following statement to connect instead:

connection = ceODBC.connect(DSN, autocommit=True)

For further information see

http://ceodbc.readthedocs.org

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ceODBC-3.1.tar.gz (171.4 kB view hashes)

Uploaded Source

Built Distributions

ceODBC-3.1-cp311-cp311-win_amd64.whl (782.4 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

ceODBC-3.1-cp311-cp311-win32.whl (700.6 kB view hashes)

Uploaded CPython 3.11 Windows x86

ceODBC-3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

ceODBC-3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

ceODBC-3.1-cp310-cp310-win_amd64.whl (630.7 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

ceODBC-3.1-cp310-cp310-win32.whl (548.6 kB view hashes)

Uploaded CPython 3.10 Windows x86

ceODBC-3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.6 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

ceODBC-3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.6 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

ceODBC-3.1-cp39-cp39-win_amd64.whl (478.3 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

ceODBC-3.1-cp39-cp39-win32.whl (392.9 kB view hashes)

Uploaded CPython 3.9 Windows x86

ceODBC-3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

ceODBC-3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.0 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

ceODBC-3.1-cp38-cp38-win_amd64.whl (319.8 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

ceODBC-3.1-cp38-cp38-win32.whl (233.7 kB view hashes)

Uploaded CPython 3.8 Windows x86

ceODBC-3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

ceODBC-3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

ceODBC-3.1-cp37-cp37m-win_amd64.whl (160.3 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

ceODBC-3.1-cp37-cp37m-win32.whl (76.4 kB view hashes)

Uploaded CPython 3.7m Windows x86

ceODBC-3.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (747.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

ceODBC-3.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (738.9 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page