GBase 8s
其他
文章

使用DbtPy连接8s

发表于2025-10-23 16:21:4950次浏览4个评论

使用 DbtPy (python3)远程链接 gbase8s ,

     需要 安装 python3  python3-devel 

     python版本不高于3.7

     pip install DbtPy 

     (这里说Python版本不能高于3.7,如果我的高于3.7会出什么问题)

1

2

3

4

5

6

7

8

9

10

import sys

import DbtPy

print("Python DbtPy测试程序开始运行.\n")

connectStr="PROTOCOL=onsoctcp;HOST=172.14.23.12;SERVICE=9899;SERVER=ol_gbasedbt12;DATABASE=testdb;DB_LOCALE=en_us.8859-1;CLIENT_LOCALE=en_us.8859-1"

conn=DbtPy.connect(connectStr, "gbasedbt", "123456")

stmt = DbtPy.exec_immediate(conn, "select * from YK_YX_RELY_AVC limit 3")

data = DbtPy.fetch_assoc(stmt)

print(data)

评论

登录后才可以发表评论
用户头像
liaosnet发表于 9个月前
现在应当可以支持到3.10
用户头像
GBase用户28017发表于 9个月前
我还是高了一点点
冰凤发表于 8个月前
666
菲菲发表于 2个月前
来了