ClickHouse.Driver
1.5.0
dotnet add package ClickHouse.Driver --version 1.5.0
NuGet\Install-Package ClickHouse.Driver -Version 1.5.0
<PackageReference Include="ClickHouse.Driver" Version="1.5.0" />
<PackageVersion Include="ClickHouse.Driver" Version="1.5.0" />
<PackageReference Include="ClickHouse.Driver" />
paket add ClickHouse.Driver --version 1.5.0
#r "nuget: ClickHouse.Driver, 1.5.0"
#:package ClickHouse.Driver@1.5.0
#addin nuget:?package=ClickHouse.Driver&version=1.5.0
#tool nuget:?package=ClickHouse.Driver&version=1.5.0
ClickHouse C# client
About
Official C# client for ClickHouse. This 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.
Documentation
Full documentation is on the ClickHouse website:
Usage examples
We have a wide range of examples, aiming to cover typical scenarios of client usage. They are grouped by client: HTTP and native TCP.
Choosing a client
| 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.
ClickHouse Versions
Both clients support the last 3 releases plus the last 2 LTS releases of the ClickHouse server.
Contact us
If you have any questions or need help, feel free to reach out to us in the Community Slack or via GitHub issues.
Contributing
Contributions are welcome and highly appreciated! Check out our contributing guide.
Acknowledgements
Originally created by Oleg V. Kozlyuk
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Http (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- NodaTime (>= 3.2.3)
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Http (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- NodaTime (>= 3.2.3)
- System.Text.Json (>= 10.0.5)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Http (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- NodaTime (>= 3.2.3)
- System.Text.Json (>= 10.0.5)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Http (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Microsoft.IO.RecyclableMemoryStream (>= 3.0.1)
- NodaTime (>= 3.2.3)
- System.Text.Json (>= 10.0.5)
NuGet packages (30)
Showing the top 5 NuGet packages that depend on ClickHouse.Driver:
| Package | Downloads |
|---|---|
|
EntityFrameworkCore.ClickHouse
ClickHouse provider for Entity Framework Core. |
|
|
FreeSql.Provider.ClickHouse
FreeSql 数据库实现,基于 ClickHouse.Client Ado.net |
|
|
Xinghe.Utility
XH基础库(内部使用) |
|
|
dbup-clickhouse
DbUp makes it easy to deploy and upgrade databases. This package adds ClickHouse support. |
|
|
ClickHouse.Facades
Raw SQL migrations and contexts for ClickHouse |
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on ClickHouse.Driver:
| Repository | Stars |
|---|---|
|
dotnetcore/FreeSql
.NET aot orm, VB.NET/C# orm, Mysql/PostgreSQL/SqlServer/Oracle orm, Sqlite/Firebird/Clickhouse/DuckDB orm, 达梦/金仓/虚谷/翰高/高斯 orm, 神通 orm, 南大通用 orm, 国产 orm, TDengine orm, QuestDB orm, MsAccess orm.
|
|
|
linq2db/linq2db
Linq to database provider.
|
|
|
dotnet/nuget-trends
Check out NuGet packages adoption and what's trending on NuGet.
|
|
|
sitkoru/Sitko.Core
Sitko.Core is a set of libraries to help build .NET Core applications fast
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.5.0 | 2,146 | 9/28/2026 |
| 1.4.0 | 82,131 | 9/2/2026 |
| 1.4.0-rc2 | 172 | 8/24/2026 |
| 1.4.0-rc1 | 123 | 8/18/2026 |
| 1.3.0 | 161,092 | 6/29/2026 |
| 1.3.0-rc1 | 353 | 6/24/2026 |
| 1.2.0 | 267,987 | 4/14/2026 |
| 1.1.0 | 251,565 | 3/24/2026 |
| 1.0.2 | 38,121 | 3/10/2026 |
| 1.0.1 | 40,812 | 3/3/2026 |
| 1.0.0 | 116,046 | 2/17/2026 |
| 1.0.0-rc2 | 318 | 2/12/2026 |
| 1.0.0-rc1 | 9,002 | 1/21/2026 |
| 0.9.0 | 181,774 | 12/3/2025 |
| 0.8.1 | 48,014 | 11/19/2025 |
| 0.8.0 | 3,429 | 11/19/2025 |
| 0.7.20 | 390,127 | 8/19/2025 |
| 0.7.19 | 124,976 | 8/13/2025 |
| 0.7.18 | 11,640 | 8/2/2025 |
v1.5.0
---
**New Features:**
* **Experimental native TCP client.** `ClickHouseTcpClient` connects to ClickHouse over the native protocol (port 9000, or 9440 with TLS). Configure it with a connection string or `ClickHouseTcpClientOptions`. It reads rows, POCOs, or columnar blocks, and inserts rows, POCOs, or typed columns. In our benchmarks against the HTTP client in v1.4.0, reads are up to 2x faster, inserts are up to 1.5x faster, and managed allocations are much lower. It ships in the `ClickHouse.Driver` package for .NET 8 and later. It is a separate API from `ClickHouseClient` and has no ADO.NET layer. The API can change in a future release, so using it causes warning `CHTCP0001`. See the [documentation](https://clickhouse.com/docs/integrations/language-clients/csharp/tcp) and the [examples](https://github.com/ClickHouse/clickhouse-cs/tree/main/examples/Tcp).
**Improvements:**
* Added `RowIndex` to `ClickHouseBulkCopySerializationException` so binary-insert failures report the zero-based index of the offending row within the batch, making it easy to locate bad data in large inserts. (Thanks to @mbtolou - #606 and @Skyuzii - #608)
**Bug Fixes:**
* Fixed a wall-clock shift when reading a `DateTime`/`DateTime64` column whose `Fixed/UTC±HH:MM:SS` timezone name has a minute or second field above 59. The server carries such a field into the next one, so `Fixed/UTC+05:60:00` means +06:00; the driver rejected the name and read the value as UTC. (#612)