Name | gbase8sdb JSON |
Version |
0.1.2
JSON |
| download |
home_page | None |
Summary | Python interface to GBase 8s Database |
upload_time | 2025-03-11 02:13:12 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT |
keywords |
gbase 8s
database
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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 3.0.0 版本及以上。
#### 使用说明
1. gbase8sdb驱动连接数据库依赖GSDK 3.0.0版本及以上,所以您需要联系GBase 8s技术支持或通过官方渠道获取相应版本的GSDK,并安装到您的机器上, 并设置如下环境变量:
```bash
GSDK_PATH=/path/to/gsdk
export LD_LIBRARY_PATH=${GSDK_PATH}/lib:$LD_LIBRARY_PATH
```
#### 入门
在您的Python应用程序中,可以通过以下方式连接到数据库:
```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()
```
Raw data
{
"_id": null,
"home_page": null,
"name": "gbase8sdb",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "GBase 8s, database",
"author": null,
"author_email": null,
"download_url": null,
"platform": null,
"description": "# python-gbase8sdb\n\npython-gbase8sdb \u662f\u4e00\u4e2a [Python \u7f16\u7a0b\u8bed\u8a00][python] \u6269\u5c55\u6a21\u5757\uff0c\u5141\u8bb8 Python \u7a0b\u5e8f\u8fde\u63a5\u5230 GBase 8s \u6570\u636e\u5e93\u3002\n\n\u8be5\u6a21\u5757\u7b26\u5408 [Python \u6570\u636e\u5e93 API 2.0 \u89c4\u8303][pep249]\uff0c\u5e76\u4e14\u5305\u542b\u5927\u91cf\u6269\u5c55\u548c\u5c11\u6570\u6392\u9664\u9879\u3002\n\n\n## \u5b89\u88c5\n\n\u8fd0\u884c `python -m pip install gbase8sdb` \u5b89\u88c5\u3002\n\n\n## \u4f9d\u8d56\u548c\u4e92\u64cd\u4f5c\u6027\n\n- \u652f\u6301\u7684 Python \u7248\u672c\uff1a3.7 \u81f3 3.12 \u3002\n\n- \u652f\u6301\u7684 GBase 8s \u6570\u636e\u5e93\u7248\u672c\uff1aGBase 8s V8.8_3.6.2\u7248\u672c\u53ca\u4ee5\u4e0a\u3002\n\n- \u652f\u6301\u7684\u64cd\u4f5c\u7cfb\u7edf\uff1aLinux x86_64 \u3002\n\n- \u4f9d\u8d56 GSDK 3.0.0 \u7248\u672c\u53ca\u4ee5\u4e0a\u3002\n\n\n#### \u4f7f\u7528\u8bf4\u660e\n\n1. gbase8sdb\u9a71\u52a8\u8fde\u63a5\u6570\u636e\u5e93\u4f9d\u8d56GSDK 3.0.0\u7248\u672c\u53ca\u4ee5\u4e0a\uff0c\u6240\u4ee5\u60a8\u9700\u8981\u8054\u7cfbGBase 8s\u6280\u672f\u652f\u6301\u6216\u901a\u8fc7\u5b98\u65b9\u6e20\u9053\u83b7\u53d6\u76f8\u5e94\u7248\u672c\u7684GSDK\uff0c\u5e76\u5b89\u88c5\u5230\u60a8\u7684\u673a\u5668\u4e0a\uff0c \u5e76\u8bbe\u7f6e\u5982\u4e0b\u73af\u5883\u53d8\u91cf\uff1a\n```bash\nGSDK_PATH=/path/to/gsdk\nexport LD_LIBRARY_PATH=${GSDK_PATH}/lib:$LD_LIBRARY_PATH\n```\n\n#### \u5165\u95e8\n\u5728\u60a8\u7684Python\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff1a\n```python\nimport gbase8sdb\n\n# \u751f\u6210dsn\ndsn = gbase8sdb.makedsn(\n server_name=\"ol_gbasedbt1210_2\", # \u6570\u636e\u5e93\u5b9e\u4f8b\u540d\u79f0\n db_name=\"testdbutf8\", # \u6570\u636e\u5e93\u540d\u79f0\n host=\"192.168.xxx.xxx\", # \u6570\u636e\u5e93\u5b9e\u4f8b\u6240\u5728\u670d\u52a1\u5668\u7684IP\u5730\u5740\u6216\u57df\u540d\n port=9088, # \u6570\u636e\u5e93\u5b9e\u4f8b\u7684\u7aef\u53e3\u53f7\n db_locale='zh_CN.utf8' # \u6570\u636e\u5e93\u5b57\u7b26\u96c6\n)\nuser = \"gbasedbt\" # \u6570\u636e\u5e93\u7528\u6237\u540d\npassword = \"xxxxxx\" # \u6570\u636e\u5e93\u7528\u6237\u5bc6\u7801\n\n# \u8fde\u63a5\u6570\u636e\u5e93\nconn = gbase8sdb.connect(dsn, user, password) \n# \u521b\u5efa\u6e38\u6807 \ncursor = conn.cursor() \n# \u6267\u884cSQL\u8bed\u53e5 \ncursor.execute(\"drop table if exists t\")\ncursor.execute(\"create table t (id int, name varchar(20))\")\ncursor.execute(\"insert into t values (?, ?)\", (1, \"zhangsan\"))\ncursor.execute(\"select * from t\")\n# \u83b7\u53d6\u67e5\u8be2\u7ed3\u679c\nprint(cursor.fetchall())\n# \u5173\u95ed\u6e38\u6807\u548c\u8fde\u63a5\ncursor.close()\nconn.close()\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python interface to GBase 8s Database",
"version": "0.1.2",
"project_urls": null,
"split_keywords": [
"gbase 8s",
" database"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f0a7a73acff903408100964e62c2e31629440f4d0f2b5aa4b61285576695d4e9",
"md5": "33080a8503e30b8b9fb38c4bab6435a0",
"sha256": "037695094fd92a5735f72aa73298c2fe9290a0b7be16a8cfc002c50c2533f2ac"
},
"downloads": -1,
"filename": "gbase8sdb-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "33080a8503e30b8b9fb38c4bab6435a0",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.7",
"size": 1703663,
"upload_time": "2025-03-11T02:13:12",
"upload_time_iso_8601": "2025-03-11T02:13:12.882378Z",
"url": "https://files.pythonhosted.org/packages/f0/a7/a73acff903408100964e62c2e31629440f4d0f2b5aa4b61285576695d4e9/gbase8sdb-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2d3606ffd193c0771e703095e160b3804f51c67553d5e0fd5ec580d686b76a0e",
"md5": "462a99dd302fff1cf33fa555f23d0e5b",
"sha256": "0b3cd50f6c1318fc5f983cc99f2bd58c96b7f33af209330438798643a784f2c3"
},
"downloads": -1,
"filename": "gbase8sdb-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "462a99dd302fff1cf33fa555f23d0e5b",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.7",
"size": 1845856,
"upload_time": "2025-03-11T02:13:18",
"upload_time_iso_8601": "2025-03-11T02:13:18.175019Z",
"url": "https://files.pythonhosted.org/packages/2d/36/06ffd193c0771e703095e160b3804f51c67553d5e0fd5ec580d686b76a0e/gbase8sdb-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "dabca40f4dbd389e66a8afc2f8a5c077e26a083e908575bcd3aa6032585569ed",
"md5": "cfbb70de3a0bdf94e4596346f175b378",
"sha256": "993977c732c106eb19f4ec4732e226450e089d74b8251d1df9050cc680e9ed18"
},
"downloads": -1,
"filename": "gbase8sdb-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "cfbb70de3a0bdf94e4596346f175b378",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.7",
"size": 1797194,
"upload_time": "2025-03-11T02:13:23",
"upload_time_iso_8601": "2025-03-11T02:13:23.053916Z",
"url": "https://files.pythonhosted.org/packages/da/bc/a40f4dbd389e66a8afc2f8a5c077e26a083e908575bcd3aa6032585569ed/gbase8sdb-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2846e27e9d14bcd79eeddaf017d20a8d200ca678cdb003f84cff065d16beb050",
"md5": "8b9ebf4ab14bf8710f2cfad529e83266",
"sha256": "8764618e2a0c909d6e00c26846e0264db5d99fa816a4d53aa96a1b3915dd9ed3"
},
"downloads": -1,
"filename": "gbase8sdb-0.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "8b9ebf4ab14bf8710f2cfad529e83266",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": ">=3.7",
"size": 1575131,
"upload_time": "2025-03-11T02:13:28",
"upload_time_iso_8601": "2025-03-11T02:13:28.943474Z",
"url": "https://files.pythonhosted.org/packages/28/46/e27e9d14bcd79eeddaf017d20a8d200ca678cdb003f84cff065d16beb050/gbase8sdb-0.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "dafeca5f41e888939a2e505c65dcf7d9a35483657567eb3d8f1424e6b4a4ada4",
"md5": "c77f2216cae5eb721ab4666cc3142b66",
"sha256": "d3833beef5d7df03eec280a95c06cd95d915b739d638a689484b6df784e8fb19"
},
"downloads": -1,
"filename": "gbase8sdb-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "c77f2216cae5eb721ab4666cc3142b66",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.7",
"size": 1743725,
"upload_time": "2025-03-11T02:13:35",
"upload_time_iso_8601": "2025-03-11T02:13:35.393068Z",
"url": "https://files.pythonhosted.org/packages/da/fe/ca5f41e888939a2e505c65dcf7d9a35483657567eb3d8f1424e6b4a4ada4/gbase8sdb-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "06a7239ebdc087b5224d8e4e1e17aaf76998fb57959340f7dff5748e7665ea08",
"md5": "05aeb437e8b194124657fb25c233df15",
"sha256": "7350b39cd19aeabdd96b3042f16328cdc56e2ed2be7345cf97fc853be7d9a740"
},
"downloads": -1,
"filename": "gbase8sdb-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "05aeb437e8b194124657fb25c233df15",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.7",
"size": 1705322,
"upload_time": "2025-03-11T02:13:41",
"upload_time_iso_8601": "2025-03-11T02:13:41.256783Z",
"url": "https://files.pythonhosted.org/packages/06/a7/239ebdc087b5224d8e4e1e17aaf76998fb57959340f7dff5748e7665ea08/gbase8sdb-0.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-11 02:13:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "gbase8sdb"
}