Skip to main content

Python interface to CUBRID

Project description

cubrid_db

Overview

cubrid_db is a Python package that implements Python Database API 2.0, for the CUBRID DBMS.

In addition to the minimal feature set of the standard Python DB API, cubrid_db API also exposes nearly the entire native client API of the database engine in the _cubrid package.

Project URL

Dependencies

  • CUBRID >=10.1 (prepared for 11.2 by default)
  • OS
    • Linux (64bit)
    • Other Unix and Unix-like os
    • Windows (x86 and x86_64) (not tested yet)
  • Python: Python >=3.9
  • Compiler:
    • GNU Developer Toolset 6 or higher
    • CMake
    • Bash
    • Visual Studio 2015 (for Windows)

Build instructions

Clone the repository:

$ git clone --recursive git@github.com:zimbrul-co/cubrid_db.git

Enter the package root directory:

$ cd cubrid_db

If your CUBRID version is different from 11.2, enter the cci-src directory and change the CCI version to match your CUBRID version:

$ cd cci-src
$ git tag -l
v10.1
v10.2
v10.2.1
v10.2.3
v11.0
v11.0.1
v11.1.0.0013
v11.2.0.0029
$ git checkout v11.2.0.0029 # replace this with the required version
$ cd ..

Note: As of 23 February 2024, CUBRID 11.3 is not present in cci-src tags.

Build:

$ python setup.py build

Note: CCI is built first, from cci-src. Note: Older CCI versions use automake/autoconf, newer version use CMake.

Install:

$ sudo python setup.py install   # (Windows: python setup.py install)

Sample usage

Prepare virtual environment:

$ python -m venv venv
$ source venv/bin/activate
(venv) $ pip install -e .

Start demodb from the CUBRID distribution:

$ cubrid service start
$ cubrid server start demodb

Sample Python script:

import cubrid_db

con = cubrid_db.connect(
    dsn = 'CUBRID:localhost:33000:demodb:::',
    user = 'public',
)
cur = con.cursor()

cur.execute('CREATE TABLE test_cubrid (id NUMERIC AUTO_INCREMENT, name STRING)')
cur.execute("insert into test_cubrid (name) values (?)", ['Tom',])
cur.execute('select * from test_cubrid')
cur.fetchall()

cur.close()
con.close()

Testing

Make sure you are in the virtual environment. Install the testing requirements and run pytest.

(venv) $ pip install -r tests/requirements.txt
(venv) $ pytest

Django CUBRID backend - django_cubrid

Documents

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

cubrid_db-0.7.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

cubrid_db-0.7.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

cubrid_db-0.7.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

cubrid_db-0.7.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

cubrid_db-0.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

cubrid_db-0.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

cubrid_db-0.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

cubrid_db-0.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

cubrid_db-0.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

cubrid_db-0.7.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

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

cubrid_db-0.7.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view hashes)

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

cubrid_db-0.7.1-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

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