RepoDb.ClickHouse
0.0.1-alpha1
Prefix Reserved
dotnet add package RepoDb.ClickHouse --version 0.0.1-alpha1
NuGet\Install-Package RepoDb.ClickHouse -Version 0.0.1-alpha1
<PackageReference Include="RepoDb.ClickHouse" Version="0.0.1-alpha1" />
<PackageVersion Include="RepoDb.ClickHouse" Version="0.0.1-alpha1" />
<PackageReference Include="RepoDb.ClickHouse" />
paket add RepoDb.ClickHouse --version 0.0.1-alpha1
#r "nuget: RepoDb.ClickHouse, 0.0.1-alpha1"
#:package RepoDb.ClickHouse@0.0.1-alpha1
#addin nuget:?package=RepoDb.ClickHouse&version=0.0.1-alpha1&prerelease
#tool nuget:?package=RepoDb.ClickHouse&version=0.0.1-alpha1&prerelease
RepoDb.ClickHouse — RepoDB for ClickHouse
The dedicated ClickHouse provider for RepoDB — a fast, lightweight .NET ORM that lets you use raw SQL and fluent operations side by side on the same connection. Built on top of RepoDb and ClickHouse.Driver, the official .NET ADO.NET client for ClickHouse.
Important Pages
- GitHub Home — core library and source code.
- Website — full documentation, API reference, and blog.
Community
- GitHub Issues — bug reports and feature requests.
- Microsoft Teams — live Q&A.
- GitHub Discussions — ask questions and share ideas.
- X / Twitter — news and updates.
Dependencies
- ClickHouse.Driver — the official ADO.NET client for ClickHouse that RepoDb.ClickHouse connects through, exposing
ClickHouseConnection, which RepoDb.ClickHouse wraps asRepoDbClickHouseConnection(see the note above) - use that type, not the raw driver one. IncludeUseCustomDecimals=falsein your connection string: without it,Decimalcolumns come back as the driver's ownClickHouseDecimalnumeric type rather than a plaindecimal, which RepoDb's compiled reader cannot cast to adecimal/decimal?entity property. - RepoDb — the RepoDB core library.
Disclaimer
DateTime64 columns: ClickHouse.Driver infers a plain .NET
DateTimeparameter's type asDateTime(whole-second precision) - it has no visibility into the actual target column's type. Writing aDateTimevalue that carries fractional seconds into aDateTime64(N)column silently truncates them to whole seconds unless the parameter's type is stated explicitly. Decorate the property with[RepoDb.Attributes.Parameter.ClickHouse.ClickHouseType("Nullable(DateTime64(3))")](matching the column's actual scale) to preserve sub-second precision on Insert/Update.
public class Customer
{
public long Id { get; set; }
[ClickHouseType("Nullable(DateTime64(3))")]
public DateTime? LastUpdatedUtc { get; set; }
}
License
Apache-2.0 — Copyright © 2026 Michael Camara Pendon
Installation
Install-Package RepoDb.ClickHouse
Or visit the installation page for more options.
Get Started
Initialize the bootstrapper once at application startup:
GlobalConfiguration
.Setup()
.UseClickHouse();
Waiting for mutations: ClickHouse's
ALTER TABLE ... UPDATE/DELETErun as asynchronous background mutations rather than synchronous statements, so a row change is not guaranteed to be visible the instant the call returns. PassisWaitForMutationsEnabled: truetoUseClickHouse()to have this waited on - honored byRepoDb.ClickHouse.BulkOperations'sBulkMerge/BulkUpdate/BulkDelete/BulkDeleteByKey, which block until each mutation actually completes (up to a 5-second timeout) before returning, at the cost of extra latency per call. It defaults tofalsehere (fire-and-forget); the underlyingClickHouseDbSetting.IsWaitForMutationsEnabledproperty itself defaults totruewhen the setting is constructed directly rather than throughUseClickHouse().
Then use any RepoDB operation directly on your RepoDbClickHouseConnection, pointed at your ClickHouse server:
Query
using (var connection = new RepoDbClickHouseConnection(ConnectionString))
{
var customer = connection.Query<Customer>(c => c.Id == 10045);
}
Insert
var customer = new Customer
{
Id = 10046,
FirstName = "John",
LastName = "Doe",
IsActive = true
};
using (var connection = new RepoDbClickHouseConnection(ConnectionString))
{
// ClickHouse has no server-generated identity - the primary key is supplied by the caller
connection.Insert<Customer>(customer);
}
Update
using (var connection = new RepoDbClickHouseConnection(ConnectionString))
{
var customer = connection.Query<Customer>(10045).First();
customer.FirstName = "John";
customer.LastUpdatedUtc = DateTime.UtcNow;
// Translated to an asynchronous 'ALTER TABLE ... UPDATE ... WHERE' mutation
var affectedRows = connection.Update<Customer>(customer);
}
Delete
using (var connection = new RepoDbClickHouseConnection(ConnectionString))
{
var customer = connection.Query<Customer>(10045).First();
var deletedCount = connection.Delete<Customer>(customer);
}
ExecuteQuery
using (var connection = new RepoDbClickHouseConnection(ConnectionString))
{
var customer = connection.ExecuteQuery<Customer>("SELECT * FROM `Customer` WHERE (Id = @Id);", new { Id = 10045 }).FirstOrDefault();
}
ExecuteNonQuery
using (var connection = new RepoDbClickHouseConnection(ConnectionString))
{
var affectedRows = connection.ExecuteNonQuery("ALTER TABLE `Customer` UPDATE FirstName = @FirstName WHERE Id = @Id;", new { FirstName = "John", Id = 10045 });
}
ExecuteScalar
using (var connection = new RepoDbClickHouseConnection(ConnectionString))
{
var count = connection.ExecuteScalar<int>("SELECT COUNT(*) FROM `Customer`;");
}
Visit the get-started page for the full guide.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- ClickHouse.Driver (>= 1.3.0)
- RepoDb (>= 1.16.0-beta3)
-
net8.0
- ClickHouse.Driver (>= 1.3.0)
- RepoDb (>= 1.16.0-beta3)
-
net9.0
- ClickHouse.Driver (>= 1.3.0)
- RepoDb (>= 1.16.0-beta3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RepoDb.ClickHouse:
| Package | Downloads |
|---|---|
|
RepoDb.ClickHouse.BulkOperations
An extension library that contains the official Bulk Operations of RepoDB for ClickHouse (using ClickHouse.Driver). |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1-alpha1 | 46 | 8/30/2026 |