About this project
chconn is a pure Go driver for ClickHouse that communicates via the native TCP protocol, optimized for high-performance, column-oriented data access. It supports full generics, enabling type-safe column operations for both inserts and selects.
Key features include:
- **Column-oriented insert and select**: Append data to typed columns and bulk insert or read block-by-block for maximum throughput.
- **Row-oriented queries**: Familiar SQL-style iteration with `Query` and `Scan`.
- **Struct scanning**: Map results directly to Go structs by field name or position, with options like `RowToStructByName`, `RowToStructByNameLax`, `RowToStructByPos`, and `RowTo`.
- **Streaming insert**: Append rows or write column batches for multi-batch inserts.
- **Parameterized queries**: Type-safe query parameters using ClickHouse native syntax.
- **Connection pooling**: Configurable pool with min/max connections, lifetime, idle time, and health checks.
- **Comprehensive type support**: Includes numeric types, strings, dates, UUID, IPs, enums, arrays, nullable, low cardinality, maps, tuples, nested, JSON, variants, dynamic, geo types, and more.
- **Compression**: LZ4 and ZSTD support.
- **TLS/SSL**: Multiple SSL modes.
- **Code generator (chgen)**: Generate Go model structs and column declarations from ClickHouse tables or SQL files.
- **SQL builder**: Fluent builder for SELECT queries with joins, conditions, grouping, and more.
- **JSON export**: Export query results as JSON objects, arrays, or per-row.
- **Progress and profile callbacks**: Monitor query execution in real time.
- **Error handling**: Typed ClickHouse errors with codes and stack traces, plus sentinel errors.
- **Context support**: All operations accept context for timeouts and cancellation.
Supported Go versions are the latest two stable releases, and ClickHouse 24.3+. The driver is tested against ClickHouse 24.3, 24.8, 25.3, 25.8, and 26.2. Benchmarks show significant performance and memory allocation improvements over other Go ClickHouse drivers.
Comments
0 people shared their preference · Deer Point appears after 10 participants
Sign in to join the discussion.