from clickhouse_driver import Client


# connect ClickHouse
client = Client(host= ,port= ,user= ,database= , password=)


# 得到table1中查询的数据导入table2中(database2中应该事先建立对应的table2表)
query_ck_sql = """ SELECT *
FROM database1.table1
WHERE date = today() """
# 导入数据到临时表
try:
# 导入数据
client.execute("insert into {official_table_db}.{official_all_table_name} \
{query_ck_sql}".format(
official_table_db = database2,
official_table_name = table2,
query_ck_sql = query_ck_sql)
,types_check = True)
except Exception as e:
print str(e)