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 3.0.0版本及以上,所以您需要联系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.3-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.3-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.3-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.3-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.3-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.3-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.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for gbase8sdb-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc2b43f02418746681337b67d396a28f46ee9f33690952aaa2b24ba7bdd061bc
MD5 bae0d19d0590cef3360821117ba96efb
BLAKE2b-256 ea06141d17684d22312ffa2b0dcd6a6bbed06d45b8c9565b96621716ac89d527

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gbase8sdb-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 760d824b8f1df7205d48a5d4c9e6d4b7acdec903f05e5adddf8e8be14f687df8
MD5 2169bf97836e0990634bf2f05c8049f6
BLAKE2b-256 4664588c3b1c92d98eaa517e4fe7cd0c43dee445c020c40917307a0d04e216ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gbase8sdb-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bcd6ed140b9743634c649a149d41cced5baa95a07eb54e98929ee2be7969e8c8
MD5 2658fa8503d5a1a1ff5d994e3c680005
BLAKE2b-256 038b4c5e70cd57223774456deb92f79dcbded226d3205f3c6613604d0e4b8f1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gbase8sdb-0.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 abeff738327c429d79378d515da8871f025e9673e41dbbe40da936dd49ee36dc
MD5 0db46b9140d003398522c9df038585ce
BLAKE2b-256 f2e327cb9253424bee185f014ddbfc06864daf2403b0743d17c10ac1aa9f423f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gbase8sdb-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 77393c8f7fed3b631c8a5fde60a80d28133a86609a52057222be4f8f22957cf2
MD5 7b1387b1cb162aba93d3a8529e3c9c08
BLAKE2b-256 0f886afc405d6ac122680509c779e426cccc6b87c3c6b37fb5c810406c3c8112

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gbase8sdb-0.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 84011ad633d6e84197dc8cc013aef01004b8e75d322de8bee337ac4f4791f677
MD5 9bcd7d8d95ccc6bbd13caf93a9886e21
BLAKE2b-256 6b94c2b219d0b65070bbc2db41ba4ae5fd6f6de26c068abd802abd289ba92f87

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