Skip to main content

Python interface to GBase 8s Database

Project description

python-gbase8sdb

python-gbase8sdb 是一个 [Python 编程语言][python] 扩展模块,允许 Python 程序连接到 GBase 8s 数据库。

该模块符合 [Python 数据库 API 2.0 规范][pep249],并且包含大量扩展和少数排除项。

安装

运行 python -m pip install gbase8sdb 安装。

依赖和互操作性

  • 支持的 Python 版本:3.7 至 3.12 。

  • 支持的 GBase 8s 数据库版本:GBase 8s V8.8_3.6.2版本及以上。

  • 支持的操作系统:Linux x86_64 。

  • 依赖 GSDK 1.1 版本。

使用说明

  1. gbase8sdb驱动连接数据库依赖GSDK,所以您需要联系GBase 8s技术支持或通过官方渠道获取相应版本的GSDK,并安装到您的机器上, 并设置如下环境变量:
GSDK_PATH=/path/to/gsdk
export LD_LIBRARY_PATH=${GSDK_PATH}/lib:$LD_LIBRARY_PATH

入门

在您的Python应用程序中,可以通过以下方式连接到数据库:

import gbase8sdb

# 生成dsn
dsn = gbase8sdb.makedsn(
    server_name="ol_gbasedbt1210_2",    # 数据库实例名称
    db_name="testdbutf8",               # 数据库名称
    host="192.168.xxx.xxx",             # 数据库实例所在服务器的IP地址或域名
    port=9088,                          # 数据库实例的端口号
    db_locale='zh_CN.utf8'              # 数据库字符集
)
user = "gbasedbt"                       # 数据库用户名
password = "xxxxxx"                     # 数据库用户密码

# 连接数据库
conn = gbase8sdb.connect(dsn, user, password) 
# 创建游标  
cursor = conn.cursor()  
# 执行SQL语句                       
cursor.execute("drop table if exists t")
cursor.execute("create table t (id int, name varchar(20))")
cursor.execute("insert into t values (?, ?)", (1, "zhangsan"))
cursor.execute("select * from t")
# 获取查询结果
print(cursor.fetchall())
# 关闭游标和连接
cursor.close()
conn.close()

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

If you're not sure about the file name format, learn more about wheel file names.

gbase8sdb-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

gbase8sdb-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

gbase8sdb-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

gbase8sdb-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

gbase8sdb-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

gbase8sdb-0.1.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

File details

Details for the file gbase8sdb-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gbase8sdb-0.1.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 73078cc2e27aa5ac6b067649e13f3c7153b051baf77105d213c7a09635de6690
MD5 62f4c981f10d50ac41d546d768d40eaf
BLAKE2b-256 5e800b55ef12bbe5a6456b38d73f4ed06ae31821b440a59c6cbb08b897b830d0

See more details on using hashes here.

File details

Details for the file gbase8sdb-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gbase8sdb-0.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1efdc8e6ae68dad80db6c724d20f86244add69f2098657e371d338e1b67cd648
MD5 00c5d0fa9ca65885559bca146f7b23d7
BLAKE2b-256 c4b53834e1a0190b2345ad49fb7870c8d5839fff5f47cd86262d276584d3a23c

See more details on using hashes here.

File details

Details for the file gbase8sdb-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gbase8sdb-0.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06f688d01e5626df071b229fe8dcb7502884084c9569ae30002adecb9b99e146
MD5 627f09b5801f541bd6e91de04deae7e8
BLAKE2b-256 a985c475a196adfca621492d2dce0807f38914d7cb5903def5952b9dbb4e74c4

See more details on using hashes here.

File details

Details for the file gbase8sdb-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gbase8sdb-0.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8c27b83ee9b3c15af6801722bd80c94840cdaa6b72301c39a80cc584636ce987
MD5 e3cc780fb6703b78e94da8943833fdc5
BLAKE2b-256 922324d4a1291435cac84bd9bd4abf661800f2e62cb3958ca83dcd9e397b5674

See more details on using hashes here.

File details

Details for the file gbase8sdb-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gbase8sdb-0.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f056c6dad76bc2f3935cab4102f9d726b66ddb13dc4bfedad8b7e5ab5a5d3e22
MD5 65586631c818c0a23e4230f2112ee84c
BLAKE2b-256 36040936aa057a427f045cd25edb4eabcb9a9f7a9e19aea4d1e0d1851b771a9e

See more details on using hashes here.

File details

Details for the file gbase8sdb-0.1.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gbase8sdb-0.1.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c479d6caf3b581273c7c2b78b0e3e82a065a71ad188d180df1a90c65b2c5b93e
MD5 51d990be0fd517e2f31a94040569f5dd
BLAKE2b-256 107145f5d7e60f962601b08b3616b9b8c5279b3c7505521381d5122128844bfa

See more details on using hashes here.

Supported by

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