RepoDb.ClickHouse 0.0.1-alpha1

Prefix Reserved
This is a prerelease version of RepoDb.ClickHouse.
dotnet add package RepoDb.ClickHouse --version 0.0.1-alpha1
                    
NuGet\Install-Package RepoDb.ClickHouse -Version 0.0.1-alpha1
                    
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="RepoDb.ClickHouse" Version="0.0.1-alpha1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RepoDb.ClickHouse" Version="0.0.1-alpha1" />
                    
Directory.Packages.props
<PackageReference Include="RepoDb.ClickHouse" />
                    
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 RepoDb.ClickHouse --version 0.0.1-alpha1
                    
#r "nuget: RepoDb.ClickHouse, 0.0.1-alpha1"
                    
#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 RepoDb.ClickHouse@0.0.1-alpha1
                    
#: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=RepoDb.ClickHouse&version=0.0.1-alpha1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=RepoDb.ClickHouse&version=0.0.1-alpha1&prerelease
                    
Install as a Cake Tool

ClickHouseBuild ClickHouseHome ClickHouseVersion

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

Dependencies

  • ClickHouse.Driver — the official ADO.NET client for ClickHouse that RepoDb.ClickHouse connects through, exposing ClickHouseConnection, which RepoDb.ClickHouse wraps as RepoDbClickHouseConnection (see the note above) - use that type, not the raw driver one. Include UseCustomDecimals=false in your connection string: without it, Decimal columns come back as the driver's own ClickHouseDecimal numeric type rather than a plain decimal, which RepoDb's compiled reader cannot cast to a decimal/decimal? entity property.
  • RepoDb — the RepoDB core library.

Disclaimer

DateTime64 columns: ClickHouse.Driver infers a plain .NET DateTime parameter's type as DateTime (whole-second precision) - it has no visibility into the actual target column's type. Writing a DateTime value that carries fractional seconds into a DateTime64(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/DELETE run as asynchronous background mutations rather than synchronous statements, so a row change is not guaranteed to be visible the instant the call returns. Pass isWaitForMutationsEnabled: true to UseClickHouse() to have this waited on - honored by RepoDb.ClickHouse.BulkOperations's BulkMerge/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 to false here (fire-and-forget); the underlying ClickHouseDbSetting.IsWaitForMutationsEnabled property itself defaults to true when the setting is constructed directly rather than through UseClickHouse().

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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