ClickHouse.Driver 1.0.0-rc1

This is a prerelease version of ClickHouse.Driver.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ClickHouse.Driver --version 1.0.0-rc1
                    
NuGet\Install-Package ClickHouse.Driver -Version 1.0.0-rc1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ClickHouse.Driver" Version="1.0.0-rc1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ClickHouse.Driver" Version="1.0.0-rc1" />
                    
Directory.Packages.props
<PackageReference Include="ClickHouse.Driver" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ClickHouse.Driver --version 1.0.0-rc1
                    
#r "nuget: ClickHouse.Driver, 1.0.0-rc1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ClickHouse.Driver@1.0.0-rc1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ClickHouse.Driver&version=1.0.0-rc1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ClickHouse.Driver&version=1.0.0-rc1&prerelease
                    
Install as a Cake Tool

ClickHouse C# client

About

Official C#/ADO.NET client for ClickHouse.

  • High performance
  • Supports bulk insertion
  • Uses compressed binary protocol over HTTP(S)
  • Available for .NET Core/Framework/Standard

Documentation

See the ClickHouse website for full documentation.

Usage examples

We have a wide range of examples, aiming to cover typical scenarios of client usage.

ClickHouse Versions

The supported versions ofthe ClickHouse database server coincide with the versions currently receiving security updates.

For the list of currently supported versions, see here.

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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (18)

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

linq2db.LINQPad

Supported databases: IBM DB2 LUW/zOS/iSeries, Firebird, IBM Informix, Microsoft Access, Microsoft Sql Server (+Azure), Microsoft Sql Server Compact, MySql, MariaDB, Oracle, PostgreSQL, SQLite, SAP HANA, SAP/Sybase ASE, ClickHouse.

ClickHouse.Facades

Raw SQL migrations and contexts for ClickHouse

Serilog.Sinks.ClickHouse

Serilog sink 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.2.0 42,778 4/14/2026
1.1.0 77,924 3/24/2026
1.0.2 23,928 3/10/2026
1.0.1 21,052 3/3/2026
1.0.0 27,698 2/17/2026
1.0.0-rc2 254 2/12/2026
1.0.0-rc1 4,923 1/21/2026
0.9.0 114,002 12/3/2025
0.8.1 40,200 11/19/2025
0.8.0 3,351 11/19/2025
0.7.20 266,379 8/19/2025
0.7.19 44,540 8/13/2025
0.7.18 10,061 8/2/2025

v?
---

**Breaking Changes:**
* **Removed feature discovery query from `OpenAsync`.** The connection's `OpenAsync()` method no longer executes `SELECT version()` to discover server capabilities. This makes connection opening instantaneous (no network round-trip) but removes the `SupportedFeatures` property from `ClickHouseConnection`. The `ServerVersion` property now throws `InvalidOperationException`.

 **Migration guidance:** If you need to check the server version:
 ```csharp
 using var reader = await connection.ExecuteReaderAsync("SELECT version()");
 reader.Read();
 var version = reader.GetString(0);
 ```

* **DateTime reading behavior changed for columns without explicit timezone.** Previously, `DateTime` columns without a timezone (e.g., `DateTime` vs `DateTime('Europe/Amsterdam')`) would use the server timezone (with `UseServerTimezone=true`) or client timezone to interpret the stored value. Now, these columns return `DateTime` with `Kind=Unspecified`, preserving the wall-clock time exactly as stored without making assumptions about timezone.

 | Column Type | Old Behavior | New Behavior |
 |-------------|--------------|--------------|
 | `DateTime` (no timezone) | Returned with server/client timezone applied | `DateTime` with `Kind=Unspecified` |
 | `DateTime('UTC')` | `DateTime` with `Kind=Utc` | `DateTime` with `Kind=Utc` (unchanged) |
 | `DateTime('Europe/Amsterdam')` | `DateTime` with `Kind=Unspecified` | `DateTime` with `Kind=Unspecified` (unchanged). Reading as DateTimeOffset has correct offset applied. |

 **Migration guidance:** If you need timezone-aware behavior, either:
 1. Use explicit timezones in your column definitions: `DateTime('UTC')` or `DateTime('Europe/Amsterdam')`
 2. Apply the timezone yourself after reading.

* **DateTime writing now respects `DateTime.Kind` property.** Previously, all `DateTime` values were treated as wall-clock time in the target column's timezone regardless of their `Kind` property. The new behavior:

 | DateTime.Kind | Old Behavior | New Behavior |
 |---------------|--------------|--------------|
 | `Utc` | Treated as wall-clock time in column timezone | Preserved as-is (instant is maintained) |
 | `Local` | Treated as wall-clock time in column timezone | Instant is maintained (inserted as UTC timestamp) |
 | `Unspecified` | Treated as wall-clock time in column timezone | Treated as wall-clock time in column timezone (unchanged) |

 Migration guidance: If you were relying on the old behavior where UTC `DateTime` values were reinterpreted in the column timezone, you should change these to `DateTimeKind.Unspecified`:
 ```csharp
 // Old code (worked by accident):
 var utcTime = DateTime.UtcNow;  // Would be reinterpreted in column timezone

 // New code (explicit intent):
 var wallClockTime = DateTime.SpecifyKind(myTime, DateTimeKind.Unspecified);
 ```

   **Important:** When using parameters, you must specify the timezone in the parameter type hint to have string values interpreted in the column timezone:
 ```csharp
 // Correct: timezone in type hint ensures proper interpretation
 command.AddParameter("dt", myDateTime, "DateTime('Europe/Amsterdam')");
 command.CommandText = "INSERT INTO table (dt_column) VALUES ({dt:DateTime('Europe/Amsterdam')})";

 // Gotcha: without timezone hint, UTC is used for interpretation
 command.AddParameter("dt", myDateTime);
 command.CommandText = "INSERT INTO table (dt_column) VALUES ({dt:DateTime})";
 // ^ String value interpreted in UTC, not column timezone!
 ```

 This differs from bulk copy operations where the column timezone is known and used automatically.

* **Removed `UseServerTimezone` setting.** This setting has been removed from the connection string, `ClickHouseClientSettings`, and `ClickHouseConnectionStringBuilder`. It no longer has any effect since columns without timezones now return `Unspecified` DateTime values without any timezone changes applied to what is returned from the server.
* **Moved `ServerTimezone` property from `ClickHouseConnection` to `ClickHouseCommand`.** The server timezone is now available on `ClickHouseCommand.ServerTimezone` after any query execution (the timezone is now extracted from the `X-ClickHouse-Timezone` response header instead of requiring a separate query).
* **Helper and extension methods made internal:** DateTimeConversions, DataReaderExtensions, DictionaryExtensions, EnumerableExtensions, MathUtils, StringExtensions.

**New Features/Improvements:**
* Added support for QBit data type. QBit is a transposed vector column, designed to allow the user to choose a desired quantization level at runtime, speeding up approximate similarity searches. See the GitHub repo for usage examples.
* Added support for setting roles at the connection and command levels.
* Added support for custom headers at the connection level.
* Added support for JWT/Bearer token authentication at both connection and command levels.
* Added `InsertRawStreamAsync` method to `ClickHouseConnection` for inserting raw data streams (CSV, JSON, Parquet, etc.) directly from files or memory. Check out the examples on GitHub for usage examples of all the above.
* When the query id has not been set, it will now be automatically generated by the client.
* Added support for writing `byte[]` values to String type columns via BulkCopy.
* Added `PingAsync` method to `ClickHouseConnection` for checking server availability via the `/ping` endpoint.
* Added support for detecting mid-stream exceptions via the `X-ClickHouse-Exception-Tag` header (ClickHouse 25.11+). When `http_write_exception_in_output_format` is set to 0 on the server, exceptions that occur while streaming results are now properly detected and thrown as `ClickHouseServerException` (which includes the exception message) instead of `EndOfStreamException`.

**Bug Fixes:**
* Fixed a crash when reading a Map with duplicate keys. The current behavior is to return only the last value for a given key.