Skip to main content

gbase8s-sqlalchemy

介绍

GBase 8s数据库的SQLAlchemy方言, 支持GBase 8s V8.8_3.6.2版本及以上。

依赖

  • gbase8sdb
  • sqlalchemy~=2.0.0

安装教程

pip install gbase8s-sqlalchemy

使用说明

  1. 方言使用python-gbase8sdb驱动连接数据库,安装gbase8s-sqlalchemy时会作为依赖进行安装,您也可以手动安装:
pip install gbase8sdb
  1. python-gbase8sdb驱动连接数据库依赖GSDK 1.1版本,所以您需要联系GBase 8s技术支持或通过官方渠道获取相应版本的GSDK,并安装到您的机器上, 并设置如下环境变量:
GSDK_PATH=/path/to/gsdk
export LD_LIBRARY_PATH=${GSDK_PATH}/lib:$LD_LIBRARY_PATH
export GBASEDBTDIR=${GSDK_PATH}/lib

入门

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

from sqlalchemy import create_engine
username = 'gbasedbt'
password = 'xxxxxx'
ip = '192.168.xxx.xxx'
port = 9088
dbname = 'testdb'
servername = 'gbase8s01'
url = f'gbase8s+gbase8sdb://{username}:{password}@{ip}:{port}/{dbname}?GBASEDBTSERVER={servername}&DB_LOCALE=zh_CN.utf8'
# 或使用sqlhosts文件连接
# url = f'gbase8s+gbase8sdb://{username}:{password}@{dbname}?GBASEDBTSERVER={servername}&DB_LOCALE=zh_CN.utf8&SQLH_FILE=/path/to/sqlhosts'
engine = create_engine(url, echo=True)

Release files for gbase8s-sqlalchemy 2.0.2

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

Built distribution (wheel)

Table of built distributions (wheels) for gbase8s-sqlalchemy 2.0.2
File Interpreter ABI Platform
gbase8s_sqlalchemy-2.0.2-py3-none-any.whl Python 3 none any Details

Release files / gbase8s_sqlalchemy-2.0.2-py3-none-any.whl

Download URL gbase8s_sqlalchemy-2.0.2-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
807bb3c60a9042f9baefce78f43340e2b61b3f11e120703050e8bfb9ca24dbcd
BLAKE2b-256 checksum
How to use checksums
8779051574dc8d2c6f1c24869c90a09df35061f6f753a3f29f9d136d7ffa4db5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.7

Release history Release notifications | RSS feed

This release

2.0.2 This release

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.4.4

1 release file

1.4.3

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.2.1

1 release file

1.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

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