Skip to main content

Python driver with native interface for ClickHouse

Project description

ClickHouse Python Driver

ClickHouse Python Driver with native (TCP) interface support.

Usage example:

from clickhouse_driver.client import Client

client = Client('localhost')

client.execute('SHOW TABLES')

client.execute('DROP TABLE IF EXISTS test')

client.execute('CREATE TABLE test (x Int32) ENGINE = Memory')

client.execute(
    'INSERT INTO test (x) VALUES',
    [{'x': 1}, {'x': 2}, {'x': 3}, {'x': 100}]
)
client.execute('INSERT INTO test (x) VALUES', [[200]])

print(client.execute('SELECT sum(x) FROM test'))

Connection Parameters

The first parameter host is required. There are some optional parameters:

  • port is port ClickHouse server is bound to. Default is 9000.

  • database is database connect to. Default is default.

  • user. Default is default.

  • password. Default is ‘’ (no password).

  • client_name. This name will appear in server logs. Default is pyclient.

You can also specify timeouts via:

  • connect_timeout. Default is 10 seconds.

  • send_receive_timeout. Default is 300 seconds.

  • sync_request_timeout. Default is 5 seconds.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clickhouse-driver-0.0.2.tar.gz (11.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page