Python访问clickhouse数据库

安装:pip install clickhouse-driver

from clickhouse_driver import Client, connect
client = connect(database="dw",user='default' ,password='root', host='192.168.1.1')
cur = client.cursor()
sql = 'select * from dw.demo limit 0, 1000'
cur.execute(sql)
ans = cur.fetchall()
print(ans[0][1])
输出显示:

 

 

 
posted @ 2021-08-04 15:07  Azuki_op  阅读(372)  评论(0)    收藏  举报