clickhouse-driver (Python)

Python driver for ClickHouse using the native TCP protocol. Provides synchronous and async (asynch) interfaces for connecting to ClickHouse databases from Python. More efficient than HTTP-based clickhouse-connect for high-throughput operations. Used by data engineers, analytics engineers, and Python ML pipelines that need to query or ingest into ClickHouse.

Evaluated Mar 06, 2026 (0d ago) v0.2+
Homepage ↗ Repo ↗ Other python clickhouse olap analytics database columnar native-protocol
⚙ Agent Friendliness
61
/ 100
Can an agent use this?
🔒 Security
81
/ 100
Is it safe for agents?
⚡ Reliability
79
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
80
Error Messages
78
Auth Simplicity
85
Rate Limits
85

🔒 Security

TLS Enforcement
88
Auth Strength
80
Scope Granularity
75
Dep. Hygiene
82
Secret Handling
80

TLS support for native protocol. Username/password auth. Keep driver updated for security patches.

⚡ Reliability

Uptime/SLA
80
Version Stability
80
Breaking Changes
78
Error Recovery
78
AF Security Reliability

Best When

You're writing synchronous Python scripts or data pipelines that need efficient ClickHouse access via the native TCP protocol with numpy/pandas support.

Avoid When

You need async-first Python, SQLAlchemy ORM, or are using ClickHouse Cloud where clickhouse-connect is the recommended official client.

Use Cases

  • Query ClickHouse from Python for analytics, data exploration, and reporting with efficient native protocol connection
  • Insert large volumes of data into ClickHouse from Python ETL pipelines and data transformation scripts
  • Use pandas DataFrames with ClickHouse via clickhouse-driver's native numpy/pandas integration for data science workflows
  • Build Python agent backends that query ClickHouse for real-time analytics and aggregated event data
  • Implement Python data pipelines that write structured agent execution logs to ClickHouse for analytics

Not For

  • Async Python applications preferring modern asyncio — use asynch (async wrapper) or clickhouse-connect (HTTP-based) for modern async support
  • Applications requiring SQLAlchemy integration — use clickhouse-sqlalchemy or clickhouse-connect for SQLAlchemy ORM support
  • Cloud-native ClickHouse environments preferring HTTP — clickhouse-connect is the official client for ClickHouse Cloud

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: basic_auth
OAuth: No Scopes: No

Username/password authentication via ClickHouse native protocol. Credentials in Client() constructor.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

MIT license. ClickHouse itself is Apache 2.0.

Agent Metadata

Pagination
cursor
Idempotent
Partial
Retry Guidance
Documented

Known Gotchas

  • Connection management is manual — the Client is not a connection pool; for concurrent Python code use separate Client instances per thread
  • Data types must match ClickHouse schema exactly — Python int/float/str may need explicit casting; UInt64 vs Int64 mismatches cause silent data corruption
  • Native protocol uses binary serialization — type errors between Python values and ClickHouse types can cause cryptic protocol errors
  • execute_iter() for streaming large results must be consumed fully or the connection blocks — always iterate to completion or use with block
  • Datetime handling requires timezone awareness — ClickHouse DateTime is UTC; naive Python datetimes may cause timezone confusion
  • clickhouse-driver is sync-only; for async Python use the 'asynch' wrapper which adds overhead; consider clickhouse-connect for native asyncio

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for clickhouse-driver (Python).

$99

Scores are editorial opinions as of 2026-03-06.

5173
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered