hologres内这个客户端有python版本嘛?
使用Python访问HologresPsycopg是Python用于操作PostgreSQL的库。Hologres兼容PostgreSQL 11,因此您可以通过psycopg访问Hologres。本文将指导您使用psycopg2访问Hologres,示例使用的操作环境为基于CentOS 7系统的Python 3.8版本。安装psycopg2模块。
# pip install psycopg2-binary
连接Hologres
conn = psycopg2.connect(host='', port=, dbname='', user='', password='', application_name='')
使用Hologres创建表
cur.execute('CREATE TABLE holo_test (num integer);')
插入数据
cur.execute('INSERT INTO holo_test SELECT generate_series(%s, %s)', (1, 1000))
参考链接https://help.aliyun.com/zh/hologres/user-guide/use-python-to-connect-to-hologres?spm=a2c4g.11186623.0.nextDoc.19343b27tOWdvj
赞1
踩0