Official C# client for ClickHouse. The ClickHouse.Driver NuGet package contains two clients:
- HTTP client:
ClickHouseClientand an ADO.NET provider for ORMs. It sends data in the RowBinary format over HTTP(S). Use it for most applications. - Native TCP client (experimental):
ClickHouseTcpClient. It uses the ClickHouse native protocol and sends data in columnar blocks.
Full documentation is on the ClickHouse website:
We have a wide range of examples, aiming to cover typical scenarios of client usage. They are grouped by client: HTTP and native TCP.
| HTTP | Native TCP | |
|---|---|---|
| Status | Stable | Experimental. The API can change in a future release. |
| Main API | ClickHouseClient, ADO.NET (ClickHouseConnection) |
ClickHouseTcpClient |
| .NET versions | 6.0 and newer | 8.0 and newer |
| Default ports | 8123 (HTTP), 8443 (HTTPS) | 9000, 9440 (TLS) |
| Performance | Fast | Even faster: about 2x for typical reads and 1.5x for writes |
| ADO.NET and ORMs (Dapper, EF Core, linq2db) | Yes | No |
| CSV, JSONEachRow, Parquet, and raw streams | Yes | No |
JSON performance |
Better: binary transfer | Text transfer only |
| Bearer authentication and custom HTTP headers | Yes | No |
| Columnar block reads | No | Yes |
| Progress, profile, and server log callbacks | No | Yes |
| W3C trace context propagation to ClickHouse | No | Yes |
The overview gives more information about when to use each client.
Both clients support the last 3 releases plus the last 2 LTS releases of the ClickHouse server.
If you have any questions or need help, feel free to reach out to us in the Community Slack or via GitHub issues.
Contributions are welcome and highly appreciated! Check out our contributing guide.
- Serilog: Serilog.Sinks.ClickHouse
- Entity Framework Core: ClickHouse.EntityFrameworkCore
- Aspire: ClickHouse.Aspire
- Semantic Kernel: ClickHouse.SemanticKernel
Originally created by Oleg V. Kozlyuk