Going to re:Invent this December? Come party with us and The Chainsmokers ->->

Installation

pip install clickhouse-connect

###Examples

Basic query

import clickhouse_connect

client = clickhouse_connect.get_client(host='<host>', port=8443, username='default', password='<password>')
query_result = client.query('SELECT * FROM system.tables')
print (query_result.result_set)

Simple 'command' without a result

import clickhouse_connect

client = clickhouse_connect.get_client()
client.command ('CREATE TABLE test_table (key UInt16, value String) ENGINE Memory')

Bulk insert of a matrix of rows and columns

data = [[100, 'value1'], [200, 'value2']]
client.insert('test_table', data)
print(client.query('SELECT * FROM test_table').result_set)
->  [(100, 'value1'), (200, 'value2')]

Other integrations

Get started with ClickHouse Cloud for free

We'll get you started on a 30 day trial and $300 credits to spend at your own pace.