Skip to main content

python-gbase8sdb

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

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

安装

运行 python -m pip install gbase8sdb 安装。

依赖和互操作性

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

  • 支持的操作系统:Linux x86_64、 Linux AArch64、 Windows 64位操作系统 。

使用说明

入门

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

import gbase8sdb

# 生成数据库连接字符串
dsn = gbase8sdb.makedsn(
    db_name="testdbutf8",               # 数据库名称,如果不连库,设置为None
    host="192.168.xxx.xxx",             # 数据库实例所在服务器的IP地址或域名,连接组时不需要提供此参数
    port=9088,                          # 数据库实例的端口号,连接组时不需要提供此参数
    db_locale='zh_CN.utf8',             # 数据库字符集, 缺省值为utf8
    sqlmode='oracle',                   # 数据库模式, 缺省值为oracle
)

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"))  # sqlmode=mysql时使用%s作为占位符
# 提交事务
conn.commit()
cursor.execute("select * from t")
# 获取查询结果
print(cursor.fetchall())
# 关闭游标和连接
cursor.close()
conn.close()

Release files for gbase8sdb 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gbase8sdb 1.1.1
File Size Uploaded
gbase8sdb-1.1.1.tar.gz 127.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gbase8sdb 1.1.1
File Interpreter ABI Platform
gbase8sdb-1.1.1-cp27-cp27mu-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.17+ x86-64 Details

Total release size: 1.3 MB

Release files / gbase8sdb-1.1.1.tar.gz

Download URL gbase8sdb-1.1.1.tar.gz
Size 127.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bfddc85fdb686ab1d0aef09eda4d3da341a7b1bd1f792ba665aa40656f3f57f5
BLAKE2b-256 checksum
How to use checksums
d4057312accfb603282b472715211740b88dcb676daf541d81c948494dc63046
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.7

Release files / gbase8sdb-1.1.1-cp27-cp27mu-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL gbase8sdb-1.1.1-cp27-cp27mu-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.2 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
452b881d641f5d391cb256f4bd876cc9d91a623b9fa9000f119a7d75a1b96bdc
BLAKE2b-256 checksum
How to use checksums
814a8af366b36ffcbf6d26dbc7b9ad4c064bc416f6694f166a34a990a9e43c4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.7

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

2 release files

1.0.0

1 release file

0.2.5

7 release files

0.2.1

19 release files

0.2.0

6 release files

0.1.4

6 release files

0.1.3

6 release files

0.1.2

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page