Skip to main content

Python driver with native interface for ClickHouse

Project description

ClickHouse Python Driver

https://img.shields.io/pypi/v/clickhouse-driver.svg https://coveralls.io/repos/github/mymarilyn/clickhouse-driver/badge.svg?branch=master https://img.shields.io/pypi/pyversions/clickhouse-driver.svg https://img.shields.io/pypi/l/clickhouse-driver.svg https://travis-ci.org/mymarilyn/clickhouse-driver.svg?branch=master

ClickHouse Python Driver with native (TCP) interface support.

Asynchronous wrapper is available here: https://github.com/mymarilyn/aioch

Features

  • 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

Documentation is available at https://clickhouse-driver.readthedocs.io.

Usage

>>> 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,)]

License

ClickHouse Python Driver is distributed under the MIT license.

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.20.tar.gz (36.7 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: clickhouse-driver-0.0.20.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/36.5.0 requests-toolbelt/0.8.0 tqdm/4.17.1 CPython/3.5.2

File hashes

Hashes for clickhouse-driver-0.0.20.tar.gz
Algorithm Hash digest
SHA256 b27de896bc578c081c25e92c82c8e18fe6a811df9e13b9723cafa7de16d84b3d
MD5 2c1e1e21d7f18c1d7d2808213d82c8c2
BLAKE2b-256 9ea4bc945ee53254b6f38fd9c7ee6e97a5834c116a68220d1910bf0850c7bc64

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