clickhouse-go is a Go driver for ClickHouse that provides both native and standard database/sql interfaces to the analytics database.
The driver addresses the need to query and write data to ClickHouse from Go applications. It offers two distinct approaches: a native interface that uses ClickHouse's native TCP protocol with direct column encoding for optimal performance, and a standard database/sql interface for compatibility with existing Go tooling and ORMs. Both interfaces support TCP and HTTP transports. The native interface leverages the low-level ch-go client for encoding, decoding, and compression, while the standard interface trades some performance for broader ecosystem compatibility.
Developers should choose the native interface for new performance-sensitive code and the standard database/sql interface when integrating with existing tools or ORMs that expect the standard library's database/sql contract. The driver supports bulk writes, async inserts, connection pooling, failover and load balancing, and a wide range of ClickHouse types including newer additions like Dynamic and Variant. It handles multiple compression algorithms, JWT authentication, and advanced protocol features such as query IDs, quotas, and OpenTelemetry integration through context parameters.
The project maintains active test coverage across supported ClickHouse versions and Go releases, with structured logging via the standard log/slog package. Development tracks compatibility across multiple Go versions, requiring updates to supported version ranges as language releases advance. The codebase includes comprehensive examples demonstrating both native and standard interfaces, bulk operations, and struct marshaling patterns.