Skip to main content

GBase 8s Dialect for SQLAlchemy

Project description

gbase8s-sqlalchemy

介绍

GBase 8s数据库的SQLAlchemy方言,需要SQLAlchemy 2.0或更高版本,Python版本需要Python 3.7或更高版本, 支持GBase 8s V8.8_3.6.2版本及以上。

安装教程

pip install gbase8s-sqlalchemy

使用说明

  1. 方言使用python-gbase8sdb驱动连接数据库,安装sqlalchemy-gbase8s时会作为依赖进行安装,您也可以手动安装:
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

入门

在您的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)

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 Distribution

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

gbase8s_sqlalchemy-0.1.1-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file gbase8s_sqlalchemy-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gbase8s_sqlalchemy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d00e0e613c08bbe98314cc702753347204587231a911c3c2ddb9e4c62dfcd47
MD5 bb00d1bd08b073dcc91c971cee1bb09b
BLAKE2b-256 834234902d2eb6ebf1bfda9eb90151140524a35f2d8fac52c429a4e368a1cb1a

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