python连接clickhouse (CK)

'''
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 Client

client = Client(
    host = '192.168.56.16',
    port = '9000', # 或 9000
    user = 'acai',
    password = '123456@abc.COM',
    database = 'default'
)
def test():
    global client
    sql = 'show tables' # show databases;
    res = client.execute(sql)
    print(res)

if __name__ == '__main__':
    test()
相关推荐
吹老师个人app编程教学15 小时前
clickhouse-题库
clickhouse
fusugongzi15 小时前
clickhouse一直重启,日志提示structure needs cleaning
clickhouse
arnold6617 小时前
深入探索 ClickHouse:性能优化之道
clickhouse·性能优化
孤独天狼2 天前
Clickhouse(Centos)
clickhouse
Favor_Yang2 天前
C# 连接ClickHouse 数据库
数据库·clickhouse·c#
fusugongzi3 天前
clickhouse优化记录
clickhouse
吹老师个人app编程教学3 天前
clickhouse-副本和分片
java·服务器·clickhouse
天地风雷水火山泽4 天前
二百七十九、ClickHouse——用Kettle对DWD层清洗数据进行增量补全
clickhouse
天地风雷水火山泽4 天前
二百八十、ClickHouse——用Kettle对DWD层补全的清洗数据进行记录
大数据·clickhouse·kettle
wending-Y4 天前
clickhouse 查询优化思路
clickhouse