ClickHouse Driver

Python driver for ClickHouse using its native TCP protocol

SDK
PyPI
v0.2.11
1,302stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
73/100Good
Development Activity60
Maintenance48
Community84
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture78
Code Quality79
Innovation68
Learning Curve70

clickhouse-driver is a Python client for ClickHouse that speaks the database’s native TCP protocol rather than the HTTP interface, giving faster, more efficient query execution and result streaming. It supports the full ClickHouse type system (Array, Nullable, LowCardinality, Decimal, Map, Tuple, JSON, and more), compression, TLS, and query settings.

It ships both a native client API and a DB-API 2.0 compatible interface (clickhouse_driver.dbapi), plus optional Cython-accelerated components for performance-critical paths and NumPy/Arrow integration for efficient bulk data transfer into scientific Python workflows.

What You Get

  • Native TCP protocol client (faster than the HTTP interface) with Client.execute() for queries
  • A DB-API 2.0 compatible interface (clickhouse_driver.dbapi) for use with existing SQL tooling
  • Full ClickHouse type support (Array, Nullable, LowCardinality, Decimal, Map, Tuple, JSON, IPv4/IPv6, and more)
  • Cython-accelerated read/write buffers for performance-critical serialization paths
  • NumPy and Arrow integration for efficient bulk data transfer into analytics workflows

Common Use Cases

  • Running analytical queries against ClickHouse from Python ETL or reporting scripts
  • Bulk-loading large datasets into ClickHouse tables efficiently via the native protocol
  • Integrating ClickHouse as a data source for pandas/NumPy-based data analysis pipelines
  • Using ClickHouse through SQLAlchemy or other DB-API-based tools via the dbapi interface
  • Streaming large query results block-by-block without loading everything into memory at once

Under The Hood

Architecture - The clickhouse_driver package centers on connection.py and client.py, which implement the native ClickHouse wire protocol (protocol.py), with columns/ housing per-type (de)serialization logic, streams/ handling block-by-block result iteration, and a separate dbapi/ subpackage layering PEP 249 (DB-API 2.0) semantics on top of the native client. Tech Stack - Core serialization hot paths (bufferedreader/bufferedwriter, varint) are implemented in Cython (.pyx/.c files) for performance, with optional numpy and arrow submodules for zero-copy-ish bulk data exchange, and TLS/compression support built directly into the connection layer. Code Quality - The tests/ directory contains roughly 70 test files covering type serialization, compression, TLS, DB-API behavior, and protocol edge cases, with coverage tracked via Coveralls and CI run through GitHub Actions across supported Python versions. API Design - The native Client(...).execute('SELECT ...') call pattern is minimal for simple queries, while the DB-API layer lets it slot into existing cursor.execute()-based tooling (e.g. SQLAlchemy), though users need to choose upfront between the native and DB-API surfaces depending on which ecosystem they’re integrating with.

Used by 6 apps in this directory

C++
69%
Apache 2.0

ClickHouse

Databases · Analytics · Data Engineering

49,325

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
68
Dependency
Built with
C++69%
Python13%
Updated today
TypeScript
40%
MIT

FeatBit

Devops · Developer Tools

1,902

Self-hosted, enterprise-grade feature flag platform for safe, targeted, and data-driven feature releases.

View details
89
Repo Health
78
Technical
70
Dependency
Built with
TypeScript40%
C#37%
Updated today
Python
64%
BSD 3

Flagsmith

Developer Tools · Devops · Ab Testing Experimentation

6,518

Open-source feature flagging, remote config, and A/B/multivariate testing platform for web, mobile, and server-side apps — self-host or use the hosted SaaS.

View details
91
Repo Health
82
Technical
65
Dependency
Built with
Python64%
TypeScript31%
Updated today
Python
63%
Other

Keep

Devops · Automation · Monitoring

12,224

The open-source AIOps and alert management platform that unifies 130+ monitoring tools into a single pane of glass with AI-powered correlation, deduplication, and workflow automation.

View details
91
Repo Health
79
Technical
67
Dependency
Built with
Python63%
TypeScript36%
Updated today
TypeScript
80%
Apache 2.0

nao

AI Development · Analytics

1,570

Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.

View details
83
Repo Health
76
Technical
68
Dependency
Built with
TypeScript80%
Python19%
Updated yesterday
Python
55%
Other

PostHog

Analytics · Monitoring · Developer Tools

37,777

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
67
Dependency
Built with
Python55%
TypeScript36%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search