当前位置:首页 > 编程笔记 > 正文
已解决

python连接clickhouse (CK)

来自网友在路上 185885提问 提问时间:2023-11-03 11:54:38阅读次数: 85

最佳答案 问答题库858位专家为你答疑解惑

 

'''
Author: tkhywang 2810248865@qq.com
Date: 2023-11-01 11:28:58
LastEditors: tkhywang 2810248865@qq.com
LastEditTime: 2023-11-01 11:36:25
FilePath: \PythonProject02\Python读取clickhouse2 数据库数据.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''# 注意代码中是clickhouse_driver,而pip安装包是clickhouse-driver。因为python代码习惯用下划线
from clickhouse_driver import Clientclient = Client(host = '192.168.56.16',port = '9000', # 或 9000user = 'acai',password = '123456@abc.COM',database = 'default'
)
def test():global clientsql = 'show tables' # show databases;res = client.execute(sql)print(res)if __name__ == '__main__':test()

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"python连接clickhouse (CK)":http://eshow365.cn/6-31032-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!