Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 14 min read Release mediumAdept

What's new in the ClickHouse .NET Driver: the road from 1.0 to 1.3

ClickHouse's .NET driver versions 1.1 through 1.3 rework the insert, read and parameter paths. POCO registration replaces hand-built object[] rows for both inserts and typed QueryAsync<T> reads, with eager validation, precompiled accessors, attribute-based column mapping and JSON column support. Three optional extension points (IParameterTypeResolver, IParameterFormatter, IReadValueConverter) let callers control type inference, wire formatting and read-side conversion, and add no overhead when unused. The releases also add multidimensional arrays, ValueTuples and server-side Identifier parameters, plus a breaking fix that sends UTC/Local DateTime parameters as DateTime('UTC') so values are no longer shifted by the server's session time zone.

Related posts

  • ClickHouse.Driver 1.0.0: The Official .NET Client Hits Stable

    ClickHouse mediumAdept

    ClickHouse.Driver 1.0.0 is the first stable release of the official .NET client for ClickHouse, committing to a semver-stable public API. It introduces a thread-safe, singleton-friendly ClickHouseClient that replaces most ADO.NET usage and the deprecated ClickHouseBulkCopy, and adds parameter type extraction from SQL, JWT/roles/custom headers, POCO serialization to JSON columns, mid-stream exception detection and QBit vector support. Breaking changes matter for upgrades: .NET Framework/Standard support is dropped, timezone-less DateTime columns now return Kind=Unspecified, and JSON writes default to string mode parsed server-side, which can change inferred types (e.g. Int32 to Int64).

  • Introducing the (blazing fast!) native TCP client for .NET

    ClickHouse mediumAdept

    ClickHouse's new experimental .NET client in the ClickHouse.Driver package speaks the native TCP protocol and the columnar Native format. This removes the row/column conversions that HTTP with RowBinary forces on both server and client. It is built on zero-copy, pooled buffers and MemoryMarshal reinterpretation, with compiled expression-tree mappers for POCOs and SIMD where wire and .NET layouts differ (e.g. UUID). The result is 1.5-2x faster reads and inserts than HTTP, up to 1.1M rows/s on a single stream, and allocations for a 1M-row read cut from 1.6 GB to 6 MB. The tradeoffs: no ADO.NET/ORM support, text-only JSON, borrowed blocks valid for one iteration, and little gain on the object[] tier.

  • What's New in pg_clickhouse - JSONB Support, SQL value functions, Streaming, and more

    ClickHouse mediumAdept

    pg_clickhouse, the Postgres foreign data wrapper for querying ClickHouse, now pushes down far more operations to ClickHouse. JSONB accessors (->, ->>, jsonb_extract_path) are translated to ClickHouse sub-column syntax. CURRENT_DATE, CURRENT_TIMESTAMP and clock_timestamp() are translated to ClickHouse now()/now64()/nowInBlock64 calls that use the Postgres session time zone and timestamp precision. Array functions now map to their ClickHouse equivalents. Streaming of HTTP driver results in roughly 50MB batches kept container memory under about 100MiB during a full NYC taxi table scan, versus about 600MiB without it.

  • Structured Logging in .NET with Serilog and ClickHouse

    ClickHouse mediumAdept

    Serilog's ClickHouse sink lets an ASP.NET service write structured logs directly into a ClickHouse table with one WriteTo.ClickHouse() call. A fluent C# schema builder controls the table: typed JSON property hints, promoted columns such as CorrelationId, a text inverted index on messages, a MergeTree ORDER BY key and a TTL. The demo also covers correlation ID middleware via LogContext, single per-request summary events with UseSerilogRequestLogging and IDiagnosticContext, and flushing batched events with Log.CloseAndFlushAsync on shutdown. For production, manage the schema externally rather than letting the sink create it, and tune compression codecs and Kubernetes-aware sort keys.

  • ClickHouse as a streaming HTTP API

    ClickHouse mediumAdept

    ClickHouse 26.8 can serve a parameterized HTTP API directly, removing the thin API layer often placed in front of it. The walkthrough uses the UK property prices dataset to build endpoints with `CREATE HANDLER`. Handlers support typed query-string parameters and regex-captured path parameters, and a restricted API user supplies a JSONEachRow default format and a per-user row `limit`. Handler queries are checked only for syntax at creation, so missing tables or columns surface at call time. An application layer is still needed for business logic, orchestration or custom validation.

The quest for software engineering knowledge.

Look:
Layout: