'''
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()
python连接clickhouse (CK)
你的凯子很吊2023-11-03 18:52
相关推荐
期待着20132 天前
ClickHouse创建分布式表昨天今天明天好多天3 天前
【ClickHouse】创建表从未完美过3 天前
clickhouse自增id的处理sunny052964 天前
ClickHouse数据库SSL配置和SSL连接测试东皋长歌4 天前
ClickHouse创建账号和连接测试gengjianchun6 天前
clickhouse 安装配置东皋长歌6 天前
ClickHouse安装大嘴吧Lucy6 天前
实战攻略 | ClickHouse优化之FINAL查询加速东皋长歌6 天前
SpringBoot+ClickHouse集成从未完美过7 天前
ClickHouse集成Mysql表引擎跨服务器读表说明