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 details)

Uploaded Source

File details

Details for the file clickhouse-driver-0.0.2.tar.gz.

File metadata

File hashes

Hashes for clickhouse-driver-0.0.2.tar.gz
Algorithm Hash digest
SHA256 1d555d2567cac38138dcd3c282060d1bbd551a562ce38f6c307014646686bba5
MD5 329d93df2e5541f8a881c23cd422c4ce
BLAKE2b-256 a97ce357eba9e189adb7f732c105e7f5ad447b8d9a35f30691798265d98bc22c

See more details on using hashes here.

Supported by

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