ClickHouse Python Driver with native (TCP) interface support.
Asynchronous wrapper is available here: https://github.com/mymarilyn/aioch
- External data for query processing.
- Query settings.
- Compression support.
- TLS support (since server version 1.1.54304).
- Types support:
- Float32/64
- [U]Int8/16/32/64
- Date/DateTime('timezone')
- String/FixedString(N)
- Enum8/16
- Array(T)
- Nullable(T)
- UUID
- Decimal
- IPv4/IPv6
- LowCardinality(T)
- Query progress information.
- Block by block results streaming.
- Reading query profile info.
- Receiving server logs.
Documentation is available at https://clickhouse-driver.readthedocs.io.
>>> from clickhouse_driver import Client >>> >>> client = Client('localhost') >>> >>> client.execute('SHOW TABLES') [('test',)] >>> >>> client.execute('DROP TABLE IF EXISTS test') [] >>> >>> client.execute('CREATE TABLE test (x Int32) ENGINE = Memory') [] >>> >>> client.execute( ... 'INSERT INTO test (x) VALUES', ... [{'x': 100}] ... ) >>> client.execute('INSERT INTO test (x) VALUES', [[200]]) >>> >>> client.execute( ... 'INSERT INTO test (x) ' ... 'SELECT * FROM system.numbers LIMIT %(limit)s', ... {'limit': 3} ... ) [] >>> >>> client.execute('SELECT sum(x) FROM test') [(303,)]
ClickHouse Python Driver is distributed under the MIT license.