diff --git a/README-zh.md b/README-zh.md
index 51e5ff41ca8..57ba23a8492 100644
--- a/README-zh.md
+++ b/README-zh.md
@@ -34,7 +34,7 @@
## 安装方式
-目前,chDB 只支持在 macOS(x86_64 和 ARM64)和 Linux 上的 Python 3.9+。
+Python 包支持 macOS、Linux(x86_64 / ARM64)上的 Python 3.9+。其他绑定的版本、发布状态和功能见[跨语言能力矩阵](README.md#language-binding-capability-matrix);浏览器可试用实验性的 [WebAssembly 版本](https://wasm.chdb.io/)。
```bash
pip install chdb
```
diff --git a/README.md b/README.md
index c45070c8700..d326f260dea 100644
--- a/README.md
+++ b/README.md
@@ -626,32 +626,35 @@ Please refer to [VERSION-GUIDE.md](VERSION-GUIDE.md) for more details.
## Language Binding Capability Matrix
-The table below summarizes the user-facing capabilities of the chdb-io language bindings. It uses published versions where available; unreleased main-branch work is called out explicitly.
+Checked 2026-11-30 against package registries and tagged source. RC, source-only and unreleased `main` features are marked; runtime suites were not rerun. Binding and engine versions are independent. Use stable core `26.11.1` for native installs unless a package requires its bundled engine.
-**Data date:** 2026-09-28
-
-| Capability / dimension | Python
`chdb 4.4.0` | C / C++
`core 26.7.3` | Node.js
`chdb 3.4.0` | Go
`v2.2.0` | Rust
`1.3.1 published / 2.0 main` | Java
`1.0.0-SNAPSHOT` | Ruby
`0.1.0` | .NET
`0.0.3.69` | Bun
`1.1.0 source` | Zig
`0.0.9` | WASM
`0.4.0` |
+| Capability / dimension | Python
`chdb 4.5.1` | C / C++
`core 26.11.1` | Node.js
`chdb 3.6.0` | Go
`v2.4.0` + Arrow RC | Rust
`2.2.1` | Java
`1.1.0` | Ruby
`0.2.0` | .NET
`0.0.3.69` + main | Bun
`2.0.0 source` | Zig
`0.0.10 source` | WASM
`0.4.0` |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
-| Maturity | Stable main package | Core engine | Active release | Active release | 2.0 main, unpublished | Maven WIP | Early | Early | Experimental | Early | Experimental |
-| Install / distribution | `pip` | release / bash | npm native packages | `go get` / embedded | Cargo + static; can auto-download `libchdb` | Maven modules; JDBC + native jars WIP | RubyGems | NuGet + manual lib | Source build | Zig package | npm wasm |
-| Session / persistent path | Multi-connection same path | Multi-connection same path | Multi-connection same path | Multi-connection same path | Multi-connection same path | Multi-connection same path | Single instance | No real Session | No real Session | Basic connection | Worker connection |
-| Durable V1 | Supported | ABI primitives | Supported | Supported | 2.0 main only | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
-| Arrow output bytes | Supported | Supported | Supported | Supported | Supported | Not supported | Supported | Supported | Incomplete | Limited | Supported |
-| Typed Arrow API | `pyarrow.Table` | No language type | `apache-arrow` | Not supported | `RecordBatch` | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
-| Arrow zero-copy | Partial | C Data API | Input side | Not supported | Supported | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
-| Arrow input / registration | Python objects | C Data API | register table | Not supported | bulk insert | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
-| Streaming result | Supported | Supported | Supported | Supported | Supported | Supported | Supported | Not supported | Not supported | Supported | Supported |
-| Parameter binding | Basic support | ABI primitives | server-side | Client interpolation | server-side | server-side | Client escaping | Not supported | Not supported | Not supported | Not supported |
-| Driver / ecosystem API | DBAPI / ADBC | C ABI | `@clickhouse/client` | `database/sql` | Not supported | JDBC | SQLite style | Not supported | None | None | None |
-| Notable feature | DataStore | Embedded C ABI | L3 Kysely-style primitives | SQL driver API | Arrow C Data API | Streaming JDBC ResultSet | Ruby-style DSL | Not supported | Bun FFI | Native Zig wrapper | Browser / Worker |
-
-**Session boundary:** chdb-core allows only one active data path per process. "Multi-connection same path" means a binding can open multiple connections on the same data path; concurrent different data paths are uniformly unsupported and require closing before switching.
-
-**Arrow implementation differences:** Python and Node primarily expose Arrow IPC bytes and then convert into language objects. Go raw queries can request Arrow output bytes, but its `database/sql` row path is Parquet-based rather than a typed Arrow API. Rust 2.0 main uses the Arrow C Data Interface, can stream `RecordBatch` values directly, and supports Arrow bulk insert. Java V1 currently uses `RowBinaryWithNamesAndTypes` decoded into JDBC `ResultSet` and does not expose an Arrow Java API.
-
-**Streaming note:** The user-facing stream differs by binding. Go streams formatted result chunks and its SQL driver reads Parquet chunks; Rust can consume result streams, Arrow batch streams, and streaming inserts; Java exposes a forward-only JDBC `ResultSet`; Node/WASM expose async streams; Ruby/Zig expose chunked fetch APIs at the binding layer.
-
-**Notable feature note:** Python DataStore is a pandas-like lazy execution data layer; Node L3 Kysely-style primitives target typed SQL builder use cases; Go's SQL driver API means it integrates with the standard Go `database/sql` package; Rust's Arrow C Data API means Arrow is a first-class data path, not just an output bytes format.
+| Release status | [PyPI](https://pypi.org/project/chdb/4.5.1/) | [native release](https://github.com/chdb-io/chdb-core/releases/tag/v26.11.1) | [npm](https://www.npmjs.com/package/chdb/v/3.6.0) | [stable module](https://proxy.golang.org/github.com/chdb-io/chdb-go/v2/@v/v2.4.0.info); separate [Arrow RC](https://proxy.golang.org/github.com/chdb-io/chdb-go/v2/arrow/@v/v0.1.0-rc.1.info) | [crates.io](https://crates.io/crates/chdb-rust/2.2.1); experimental API | [Maven Central GA](https://repo.maven.apache.org/maven2/com/clickhouse/chdb/chdb-jdbc/1.1.0/); Arrow module experimental | [RubyGems](https://rubygems.org/gems/chdb-ruby/versions/0.2.0) | [NuGet](https://www.nuget.org/packages/chdb/0.0.3.69); newer main is not that package | [GitHub v2.0.0](https://github.com/chdb-io/chdb-bun/releases/tag/v2.0.0); npm still 1.0.4 | [source tag](https://github.com/chdb-io/chdb-zig/releases/tag/0.0.10); runtime not revalidated here | [npm](https://www.npmjs.com/package/chdb-wasm/v/0.4.0), experimental |
+| Install / distribution | `pip` | Shared / static release assets | npm platform packages | Dynamic / embedded; [static RC](docs/install/go.mdx) | Cargo; dynamic or `static` feature | Central driver + native JAR; optional `chdb-arrow` | Native extension + downloaded engine | NuGet + native lib; main adds runtime packages | Source + Clang; [build with core 26.11.1](docs/install/bun.mdx) | Zig 0.15.2+; Linux x86_64/aarch64 | npm; browser or Node 23+ Worker |
+| Session / persistent path | Multi-connection same path | Multi-connection same path | Multi-connection same path | Multi-connection same path | Multi-connection same path | Multi-connection same path | Single database instance | Published path wrapper; main retains per-session connections | Source: one shared native connection, reused per active path | Source connection / path API | Worker-local paths; no verified reload persistence |
+| Durable V1 | Supported | ABI primitives | Experimental adapter + native engine | Adapter requires compatible native ABI | Opt-in `durable` / `durable-s3` features | Not supported | Not supported | Not supported | Not supported | Not supported | Not supported |
+| Arrow IPC output bytes | Supported | Supported | Supported | Supported in root module | Supported | Not exposed | Supported | Source API; published package unverified | No binary-safe API | No selectable Arrow format (fixed JSONEachRow) | Arrow IPC format not verified here |
+| Typed Arrow API | `Table` / `RecordBatch` | C structs, no language type | `apache-arrow` Table / RecordBatch | Optional Arrow RC: Table / RecordBatch | Arrow 59 `RecordBatch` | Optional module: `VectorSchemaRoot` / `ArrowReader` | Not supported | Not supported | Not supported | Not supported | Not supported |
+| Direct Arrow C Data / Stream (no IPC) | Supported | Supported | Supported | Optional Arrow RC | Supported | Optional experimental module | Not supported | Not supported | Not supported | Not supported | Native C Data API not exposed |
+| Arrow input / registration | `Python(...)`, scoped registration and insert | C Data / Stream registration and insert | Table / batch / async reader registration and insert | Optional Arrow RC: batch / reader scan and insert | Scoped reader registration and direct batch / reader insert | Optional module: batch / owned-reader registration and insert | Not supported | Not supported | Not supported | Not supported | Not supported |
+| Streaming result | Formatted chunks and direct Arrow batches | Formatted chunks and Arrow batches | Async chunks and direct Arrow batches; one active stream/session | Formatted chunks; typed batches via Arrow RC | Formatted chunks, Arrow batches; streaming insert | Forward-only JDBC `ResultSet`; Arrow batch reader | Chunked query / fetch / cancel API | Not supported | Not supported | Chunked fetch / cancel API (source) | Async worker result chunks |
+| Parameter binding | Named engine parameters | Named ABI | Native named parameters, including direct Arrow queries | Stable: driver interpolation; root RC adds native named parameters | Native named parameters across query / stream / insert | JDBC `PreparedStatement`; named parameters on streaming Arrow queries | Client SQL interpolation | Not supported | Not supported | Not supported | Not supported |
+| Driver / ecosystem API | DBAPI / ADBC | C ABI | Experimental `@clickhouse/client` adapter | `database/sql` (no transactions/prepared statements) | No standard database driver in this crate | JDBC; Arrow module is not Java ADBC | SQLite-style API | No ADO.NET provider | None | None | None |
+
+Native connections can share one data path per process. Close all connections before switching paths.
+
+Direct Arrow avoids IPC serialization but may still copy buffers. Go's ordinary `database/sql` rows use Parquet; JDBC `ResultSet` uses `RowBinaryWithNamesAndTypes`. Typed Arrow is a separate API in both bindings.
+
+Go's optional Arrow and static modules select compatible root bindings; the [Go guide](docs/install/go.mdx) covers their build requirements. Rust enables `arrow` by default; `durable` and `durable-s3` are opt-in.
+
+Keep Java's driver, Arrow module and native JAR on the same version. Arrow requires its JVM access flag and a separate connection; it cannot export an existing JDBC result. JDBC transactions and batch updates are unsupported.
+
+Bun `cleanup()` deletes its data directory. Go's `Cleanup()` does so when the last session closes; use `Close()` to preserve data. The .NET main-only capabilities refer to [this source snapshot](https://github.com/chdb-io/chdb-dotnet/tree/88d9e6948e7dd95b4e14de5175713d0db1eb81ab). Zig's typed row decoding is JSON-based, not Arrow.
+
+The browser shell pins WASM 0.3.0 while npm publishes 0.4.0. Worker-local paths do not establish persistence across page reloads.
+
+API guides and source: [Python Arrow](https://github.com/chdb-io/chdb/blob/v4.5.1/docs/python-arrow-direct.md), [Node Arrow](https://github.com/chdb-io/chdb-node/blob/v3.6.0/docs/arrow.md), [Go Arrow RC](https://github.com/chdb-io/chdb-go/blob/v2/arrow/v0.1.0-rc.1/v2/arrow/README.md), [Go named parameters](https://github.com/chdb-io/chdb-go/blob/v2.5.0-rc.2/chdb/driver/driver.go), [Rust Arrow](https://github.com/chdb-io/chdb-rust/blob/v2.2.1/docs/arrow.md), [Java installation](https://github.com/chdb-io/chdb-java/blob/v1.1.0/docs/releases/1.1.0.md) and [Arrow module](https://github.com/chdb-io/chdb-java/blob/v1.1.0/chdb-arrow/README.md), [Ruby streaming](https://github.com/chdb-io/chdb-ruby/blob/v0.2.0/ext/chdb/connection.c), [Bun connections](https://github.com/chdb-io/chdb-bun/blob/v2.0.0/lib/chdb_bun.c), [Zig](https://github.com/chdb-io/chdb-zig/blob/0.0.10/src/chdb.zig), and [WASM API](https://unpkg.com/chdb-wasm@0.4.0/dist/async.d.ts).
## License
Apache 2.0, see [LICENSE](LICENSE.txt) for more information.
diff --git a/docs/guides/querying-apache-arrow.mdx b/docs/guides/querying-apache-arrow.mdx
index ba8e014ddf8..b2bcb291cc7 100644
--- a/docs/guides/querying-apache-arrow.mdx
+++ b/docs/guides/querying-apache-arrow.mdx
@@ -17,11 +17,12 @@ An Arrow `Table` holds batches of columnar data; a `RecordBatchReader` supplies
| --- | --- |
| Query an in-memory `pyarrow.Table` or one-shot `RecordBatchReader` | This guide's [`Python(arrow_table)` example](#querying-apache-arrow); [core reader behavior tests](https://github.com/chdb-io/chdb-core/blob/main/tests/test_arrow_c_stream_protocol.py) for one-shot streams |
| Install chDB and use the existing `ArrowTable` or streaming result formats | [Python installation and examples](/chdb/install/python); [Python API reference](/chdb/api/python) |
+| Use direct typed results, incremental batches, scoped registration or bulk insert without IPC | [Python 4.5.1 direct Arrow guide](https://github.com/chdb-io/chdb/blob/v4.5.1/docs/python-arrow-direct.md): `query_arrow`, `query_arrow_batches`, and `chdb.arrow.connect()`; requires core 26.11.1+ |
| Use Arrow with the pandas-like DataStore layer | [DataStore I/O](/chdb/datastore/io) and [class reference](/chdb/datastore/class-reference) — a separate API from `Python(tbl)` |
| Use Arrow Database Connectivity (ADBC), the standard database-driver API for Arrow results or bulk ingest | [ADBC installation and usage](https://clickhouse.com/docs/chdb/install/adbc); ordinary ADBC `BindStream` passes query parameters, not a temporary SQL table like `Python(tbl)` |
| Work on the native Arrow contract or C examples | [Binding contract](https://github.com/chdb-io/chdb-core/blob/main/docs/NATIVE_ARROW_BINDING_CONTRACT.md), [input example](https://github.com/chdb-io/chdb-core/blob/main/examples/chdbArrowTest.c), [query-output example](https://github.com/chdb-io/chdb-core/blob/main/examples/chdbArrowQueryTest.c) |
-This is the Python binding's Arrow documentation entry point. `ArrowTable`/`Arrow` result formats serialize Arrow data using its Inter-Process Communication (IPC) format; the pandas-like DataStore Arrow interface is another API. Consult their linked guides rather than assuming identical streaming or ownership behavior.
+This is the Python binding's Arrow documentation entry point. `ArrowTable`/`Arrow` result formats serialize Arrow data using its Inter-Process Communication (IPC) format. Python 4.5.1 also exposes direct C Data results through `query_arrow` and `query_arrow_batches`; conversion may still copy data, and partial batch streams must be closed. The pandas-like DataStore Arrow interface and ADBC driver are separate APIs. Consult their linked guides rather than assuming identical streaming or ownership behavior.
## Setup {#setup}
diff --git a/docs/index.mdx b/docs/index.mdx
index e7799299fd9..6e07720200b 100644
--- a/docs/index.mdx
+++ b/docs/index.mdx
@@ -73,6 +73,8 @@ chDB has the following language bindings:
* [Bun](/chdb/install/bun)
* [C and C++](/chdb/install/c)
+Additional bindings include [Java/JDBC](https://github.com/chdb-io/chdb-java), [Ruby](https://github.com/chdb-io/chdb-ruby), [.NET](https://github.com/chdb-io/chdb-dotnet), [Zig](https://github.com/chdb-io/chdb-zig), and experimental [WebAssembly](https://wasm.chdb.io/). Check the [capability matrix](https://github.com/chdb-io/chdb#language-binding-capability-matrix) for published versions, source-only features and platform limits. The [Go guide](/chdb/install/go#static-linking) covers its experimental static build.
+
## How do I get started? {#how-do-i-get-started}
* If you're using [Go](/chdb/install/go), [Rust](/chdb/install/rust), [NodeJS](/chdb/install/nodejs), [Bun](/chdb/install/bun) or [C and C++](/chdb/install/c), take a look at the corresponding language pages.
diff --git a/docs/install/bun.mdx b/docs/install/bun.mdx
index 802cfc1b4ac..72d962ad826 100644
--- a/docs/install/bun.mdx
+++ b/docs/install/bun.mdx
@@ -7,56 +7,47 @@ keywords: ['chdb', 'bun', 'javascript', 'typescript', 'embedded', 'clickhouse',
doc_type: 'guide'
---
-chDB-bun provides experimental FFI (Foreign Function Interface) bindings for chDB, enabling you to run ClickHouse queries directly in your Bun applications with zero external dependencies.
+chDB-bun is an experimental FFI binding. This guide builds source release `v2.0.0` with stable core `v26.11.1`; npm still serves `1.0.4`. The binding has no binary-safe Arrow, result streaming or native parameter API.
## Installation {#installation}
-First, install the required system dependencies:
-
-#### Install libchdb {#install-libchdb}
-
-```bash
-curl -sL https://lib.chdb.io | bash
-```
-
-#### Install build tools {#install-build-tools}
-
-You'll need either `gcc` or `clang` installed on your system:
+Install Bun and Clang on macOS or Linux. The build below downloads [stable core v26.11.1](https://github.com/chdb-io/chdb-core/releases/tag/v26.11.1).
-```bash
-# Install from the GitHub repository
-bun add github:chdb-io/chdb-bun
+Clone the tag and update its downloader's engine pin before building:
-# Or clone and build locally
-git clone https://github.com/chdb-io/chdb-bun.git
+```bash
+git clone --branch v2.0.0 --depth 1 https://github.com/chdb-io/chdb-bun.git
cd chdb-bun
+sed -i.bak 's/^LATEST_RELEASE=.*/LATEST_RELEASE=v26.11.1/' lib/update_libchdb.sh
bun install
bun run build
```
+Run the examples from this directory. A `bun add github:...` alone does not build the native wrapper.
+
## Usage {#usage}
-chDB-bun supports two query modes: ephemeral queries for one-time operations and persistent sessions for maintaining database state.
+The native wrapper reuses one connection for the active path. Switching paths replaces it; `Session` objects do not own independent connections. `cleanup()` closes it and deletes the data directory.
### Ephemeral queries {#ephemeral-queries}
For simple, one-off queries that don't require persistent state:
```typescript
-import { query } from 'chdb-bun';
+import { query } from './index.ts';
// Basic query
const result = query("SELECT version()", "CSV");
-console.log(result); // "23.10.1.1"
+console.log(result); // Version of the loaded native engine
// Query with different output formats
const jsonResult = query("SELECT 1 as id, 'Hello' as message", "JSON");
@@ -76,51 +67,48 @@ console.log(systemInfo);
For complex operations that require maintaining state across queries:
```typescript
-import { Session } from 'chdb-bun';
+import { Session } from './index.ts';
// Create a session with persistent storage
const sess = new Session('./chdb-bun-tmp');
-try {
- // Create a database and table
- sess.query(`
+// Create a database and table
+sess.query(`
CREATE DATABASE IF NOT EXISTS mydb;
CREATE TABLE IF NOT EXISTS mydb.users (
id UInt32,
name String,
email String
) ENGINE = MergeTree() ORDER BY id
- `, "CSV");
+`, "CSV");
- // Insert data
- sess.query(`
+// Insert data
+sess.query(`
INSERT INTO mydb.users VALUES
(1, 'Alice', 'alice@example.com'),
(2, 'Bob', 'bob@example.com'),
(3, 'Charlie', 'charlie@example.com')
- `, "CSV");
+`, "CSV");
- // Query the data
- const users = sess.query("SELECT * FROM mydb.users ORDER BY id", "JSON");
- console.log("Users:", users);
+// Query the data
+const users = sess.query("SELECT * FROM mydb.users ORDER BY id", "JSON");
+console.log("Users:", users);
- // Create and use custom functions
- sess.query("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'Hello chDB'", "CSV");
- const greeting = sess.query("SELECT hello() as message", "Pretty");
- console.log(greeting);
+// Create and use custom functions
+sess.query("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'Hello chDB'", "CSV");
+const greeting = sess.query("SELECT hello() as message", "Pretty");
+console.log(greeting);
- // Aggregate queries
- const stats = sess.query(`
+// Aggregate queries
+const stats = sess.query(`
SELECT
COUNT(*) as total_users,
MAX(id) as max_id,
MIN(id) as min_id
FROM mydb.users
- `, "JSON");
- console.log("Statistics:", stats);
+`, "JSON");
+console.log("Statistics:", stats);
-} finally {
- // Always cleanup the session to free resources
- sess.cleanup(); // This deletes the database files
-}
+// Keep the persistent database path. sess.cleanup() recursively deletes it;
+// use cleanup() only when you intentionally want to discard this data.
```
diff --git a/docs/install/go.mdx b/docs/install/go.mdx
index 8d58c33cdb8..f10dd7bb3b9 100644
--- a/docs/install/go.mdx
+++ b/docs/install/go.mdx
@@ -7,52 +7,71 @@ keywords: ['chdb', 'go', 'golang', 'embedded', 'clickhouse', 'sql', 'olap']
doc_type: 'guide'
---
-chDB-go provides Go bindings for chDB, enabling you to run ClickHouse queries directly in your Go applications with zero external dependencies.
+chDB-go runs ClickHouse queries in-process. The default binding loads a shared native library without cgo; static linking is opt-in.
## Installation {#installation}
-
-
+Install the stable module (Go 1.21+):
-First, install the chDB library:
+```bash
+go get github.com/chdb-io/chdb-go/v2@latest
+```
+
+Install [stable core v26.11.1](https://github.com/chdb-io/chdb-core/releases/tag/v26.11.1) for your platform and set `CHDB_LIB_PATH` to the absolute path of `libchdb.so`. Alternatively, import the separate [embedded-library module](https://github.com/chdb-io/chdb-go/tree/main/lib/embedded); it extracts its packaged shared library at runtime and is not static linking.
+
+For the optional CLI:
```bash
-curl -sL https://lib.chdb.io | bash
+go install github.com/chdb-io/chdb-go/v2@latest
```
-
-
+### Optional Arrow and native parameter APIs {#optional-arrow}
-Install the Go package:
+Typed Arrow input, batch results and bulk insert require a separate RC module, Go 1.23+, cgo and core `v26.11.1`:
```bash
-go install github.com/chdb-io/chdb-go@latest
+go get github.com/chdb-io/chdb-go/v2/arrow@latest
```
-Or add it to your `go.mod`:
+The Arrow module selects compatible root bindings with native named parameters (`{name:Type}`, including `sql.Named`). Positional `database/sql` arguments are interpolated; transactions and prepared statements are unsupported.
+
+Arrow uses C Data/C Stream with copies into native-owned input buffers. See the [Arrow guide](https://github.com/chdb-io/chdb-go/blob/main/v2/arrow/README.md) for types and lifetimes. If an embedded engine is older, point `CHDB_LIB_PATH` at the stable library above.
+
+### Static linking (experimental) {#static-linking}
+
+Static builds require cgo and a C toolchain on Linux or macOS (amd64/arm64). Install the static engine module:
+
+```bash
+go get go.chdb.io/chdb/static@latest
+```
+
+Add this import to the application:
+
+```go
+import _ "go.chdb.io/chdb/static"
+```
```bash
-go get github.com/chdb-io/chdb-go
+CGO_ENABLED=1 go build -tags chdb_static -o myapp .
```
-
-
+The module supplies the engine and selects compatible root bindings. Do not combine it with `lib/embedded`; `CHDB_LIB_PATH` cannot override a statically linked engine.
## Usage {#usage}
### Command line interface {#cli}
-chDB-go includes a CLI for quick queries:
+chDB-go includes a CLI for quick queries. After `go install`, use `chdb-go` if Go's binary directory is on `PATH`; `./chdb-go` only applies when you built the executable in the current directory.
```bash
# Simple query
-./chdb-go "SELECT 123"
+chdb-go "SELECT 123"
# Interactive mode
-./chdb-go
+chdb-go
# Interactive mode with persistent storage
-./chdb-go --path /tmp/chdb
+chdb-go --path /tmp/chdb
```
### Go Library - quick start {#quick-start}
@@ -66,7 +85,7 @@ package main
import (
"fmt"
- "github.com/chdb-io/chdb-go/chdb"
+ "github.com/chdb-io/chdb-go/v2/chdb"
)
func main() {
@@ -75,6 +94,7 @@ func main() {
if err != nil {
panic(err)
}
+ defer result.Free()
fmt.Println(result)
}
```
@@ -88,7 +108,7 @@ package main
import (
"fmt"
- "github.com/chdb-io/chdb-go/chdb"
+ "github.com/chdb-io/chdb-go/v2/chdb"
)
func main() {
@@ -97,37 +117,48 @@ func main() {
if err != nil {
panic(err)
}
- defer session.Cleanup()
+ defer session.Close() // Preserve /tmp/chdb-data; Cleanup() deletes the data path.
// Create database and table
- _, err = session.Query(`
- CREATE DATABASE IF NOT EXISTS testdb;
+ created, err := session.Query("CREATE DATABASE IF NOT EXISTS testdb")
+ if err != nil {
+ panic(err)
+ }
+ if created != nil {
+ created.Free()
+ }
+
+ table, err := session.Query(`
CREATE TABLE IF NOT EXISTS testdb.test_table (
id UInt32,
name String
) ENGINE = MergeTree() ORDER BY id
- `, "")
-
+ `)
if err != nil {
panic(err)
}
+ if table != nil {
+ table.Free()
+ }
// Insert data
- _, err = session.Query(`
+ inserted, err := session.Query(`
INSERT INTO testdb.test_table VALUES
(1, 'Alice'), (2, 'Bob'), (3, 'Charlie')
- `, "")
-
+ `)
if err != nil {
panic(err)
}
+ if inserted != nil {
+ inserted.Free()
+ }
// Query data
result, err := session.Query("SELECT * FROM testdb.test_table ORDER BY id", "Pretty")
if err != nil {
panic(err)
}
-
+ defer result.Free()
fmt.Println(result)
}
```
@@ -142,7 +173,7 @@ package main
import (
"database/sql"
"fmt"
- _ "github.com/chdb-io/chdb-go/chdb/driver"
+ _ "github.com/chdb-io/chdb-go/v2/chdb/driver"
)
func main() {
@@ -168,6 +199,9 @@ func main() {
}
fmt.Printf("Count: %d\n", count)
}
+ if err := rows.Err(); err != nil {
+ panic(err)
+ }
}
```
@@ -181,7 +215,7 @@ package main
import (
"fmt"
"log"
- "github.com/chdb-io/chdb-go/chdb"
+ "github.com/chdb-io/chdb-go/v2/chdb"
)
func main() {
@@ -190,10 +224,10 @@ func main() {
if err != nil {
log.Fatal(err)
}
- defer session.Cleanup()
+ defer session.Close() // Preserve /tmp/chdb-stream; Cleanup() deletes the data path.
// Execute a streaming query for large dataset
- streamResult, err := session.QueryStreaming(
+ streamResult, err := session.QueryStream(
"SELECT number, number * 2 as double FROM system.numbers LIMIT 1000000",
"CSV",
)
diff --git a/docs/install/nodejs.mdx b/docs/install/nodejs.mdx
index 16bbdbd17c3..db426df944a 100644
--- a/docs/install/nodejs.mdx
+++ b/docs/install/nodejs.mdx
@@ -7,7 +7,7 @@ keywords: ['chdb', 'nodejs', 'javascript', 'embedded', 'clickhouse', 'sql', 'ola
doc_type: 'guide'
---
-chDB-node provides Node.js bindings for chDB, enabling you to run ClickHouse queries directly in your Node.js applications with zero external dependencies.
+`chdb@3.6.0` embeds core `26.11.1` for Node.js 18+ on Linux glibc and macOS (x64/arm64). It supports sync/async queries, native named parameters and result streams. The optional `apache-arrow` peer enables typed input, batch results and bulk insert; see the [Arrow guide](https://github.com/chdb-io/chdb-node/blob/v3.6.0/docs/arrow.md) for ownership and type limits. Direct Arrow may copy buffers; `format: 'arrow'` / `toArrow()` uses IPC. The ClickHouse-client adapter and Durable APIs remain experimental.
## Installation {#installation}
@@ -89,8 +89,8 @@ try {
console.log("User Statistics:", stats);
} finally {
- // Always cleanup the session
- session.cleanup(); // This deletes the database files
+ // Close the native connection. A caller-supplied database path is preserved.
+ session.cleanup();
}
```
diff --git a/docs/install/rust.mdx b/docs/install/rust.mdx
index 78b8370a3d1..0e61a7f6fde 100644
--- a/docs/install/rust.mdx
+++ b/docs/install/rust.mdx
@@ -2,23 +2,28 @@
title: 'Installing chDB for Rust'
sidebarTitle: 'Rust'
slug: /install/rust
-description: 'How to install and use chDB Rust bindingsd'
+description: 'How to install and use chDB Rust bindings'
keywords: ['chdb', 'embedded', 'clickhouse-lite', 'rust', 'install', 'ffi', 'bindings']
doc_type: 'guide'
---
-chDB-rust provides experimental FFI (Foreign Function Interface) bindings for chDB, enabling you to run ClickHouse queries directly in your Rust applications with zero external dependencies.
+chDB-rust provides FFI (Foreign Function Interface) bindings for in-process ClickHouse queries without a separate database server. The crate has Rust dependencies and needs a compatible native chDB library at link or runtime.
## Installation {#installation}
-### Install libchdb {#install-libchdb}
+### Add the crate {#add-crate}
-Install the chDB library:
+Add the experimental `2.2.1` crate to `Cargo.toml`:
-```bash
-curl -sL https://lib.chdb.io | bash
+```toml
+[dependencies]
+chdb-rust = "=2.2.1"
```
+On Linux/macOS x86_64 and aarch64, the build uses a local `libchdb` and matching header or downloads stable core `v26.11.1`. Clang/libclang is required for FFI generation. Set `CHDB_LIB_DIR` and `CHDB_INCLUDE_DIR` to select a local engine. Distributed dynamic binaries need a runtime library path or rpath; enable the `static` feature to link the engine into the executable.
+
+The default `arrow` feature uses Arrow 59 for direct batch results, reader registration and bulk insert. Direct Arrow may copy buffers; IPC output remains separate. See the [Arrow guide](https://github.com/chdb-io/chdb-rust/blob/v2.2.1/docs/arrow.md) for types and ownership. Native named parameters work across queries, streams and inserts. `durable` and `durable-s3` are opt-in.
+
## Usage {#usage}
chDB Rust provides both stateless and stateful query execution modes.
@@ -38,7 +43,7 @@ fn main() -> Result<(), Box> {
)?;
println!("ClickHouse version: {}", result.data_utf8()?);
- // Query with CSV file
+ // Query a CSV file if data.csv exists in the working directory
let result = execute(
"SELECT * FROM file('data.csv', 'CSV')",
Some(&[Arg::OutputFormat(OutputFormat::JSONEachRow)])
@@ -51,7 +56,7 @@ fn main() -> Result<(), Box> {
### Stateful usage (Sessions) {#stateful-usage-sessions}
-For queries requiring persistent state like databases and tables:
+For queries that maintain state across calls, the example below uses a temporary directory. Add `tempdir = "0.3.7"` to your application's dependencies. The opt-in `with_auto_cleanup(true)` deletes that directory after the final handle closes; use a caller-owned path without auto-cleanup if the data must survive the process.
```rust
use chdb_rust::{
@@ -70,29 +75,25 @@ fn main() -> Result<(), Box> {
let session = SessionBuilder::new()
.with_data_path(tmp.path())
.with_arg(Arg::LogLevel(LogLevel::Debug))
- .with_auto_cleanup(true) // Cleanup on drop
+ .with_auto_cleanup(true) // Delete this temporary data directory on drop
.build()?;
// Create database and table
+ session.execute("CREATE DATABASE demo", None)?;
session.execute(
- "CREATE DATABASE demo; USE demo",
- Some(&[Arg::MultiQuery])
- )?;
-
- session.execute(
- "CREATE TABLE logs (id UInt64, msg String) ENGINE = MergeTree() ORDER BY id",
+ "CREATE TABLE demo.logs (id UInt64, msg String) ENGINE = MergeTree() ORDER BY id",
None,
)?;
// Insert data
session.execute(
- "INSERT INTO logs (id, msg) VALUES (1, 'Hello'), (2, 'World')",
+ "INSERT INTO demo.logs (id, msg) VALUES (1, 'Hello'), (2, 'World')",
None,
)?;
// Query data
let result = session.execute(
- "SELECT * FROM logs ORDER BY id",
+ "SELECT * FROM demo.logs ORDER BY id",
Some(&[Arg::OutputFormat(OutputFormat::JSONEachRow)]),
)?;
@@ -121,12 +122,9 @@ cargo build
cargo test
```
-### Development dependencies {#development-dependencies}
+### Dependency categories {#dependency-categories}
-The project includes these development dependencies:
-- `bindgen` (v0.70.1) - Generate FFI bindings from C headers
-- `tempdir` (v0.3.7) - Temporary directory handling in tests
-- `thiserror` (v1) - Error handling utilities
+The crate uses `bindgen` to generate FFI bindings during its build and `thiserror` as a regular dependency. `tempdir` is only a development dependency of the crate, so applications using the temporary-session example above must add it explicitly.
## Error handling {#error-handling}
@@ -135,9 +133,10 @@ chDB Rust provides comprehensive error handling through the `Error` enum:
```rust
use chdb_rust::{execute, error::Error};
-match execute("SELECT 1", None) {
+fn main() {
+ match execute("SELECT 1", None) {
Ok(result) => {
- println!("Success: {}", result.data_utf8()?);
+ println!("Success: {}", result.data_utf8_lossy());
},
Err(Error::QueryError(msg)) => {
eprintln!("Query failed: {}", msg);
@@ -151,6 +150,7 @@ match execute("SELECT 1", None) {
Err(e) => {
eprintln!("Other error: {}", e);
}
+ }
}
```
diff --git a/llms-full.txt b/llms-full.txt
index ea6738db9a8..03f041b8c1e 100644
--- a/llms-full.txt
+++ b/llms-full.txt
@@ -20,7 +20,7 @@ This file contains the full chDB documentation corpus. The companion index is at
# chDB
-**URL:** https://clickhouse.com/docs/chdb
+**URL:** https://clickhouse.com/docs/chdb/
chDB is an in-process SQL OLAP Engine powered by ClickHouse
@@ -82,6 +82,8 @@ chDB has the following language bindings:
* [Bun](https://clickhouse.com/docs/chdb/install/bun)
* [C and C++](https://clickhouse.com/docs/chdb/install/c)
+Additional bindings include [Java/JDBC](https://github.com/chdb-io/chdb-java), [Ruby](https://github.com/chdb-io/chdb-ruby), [.NET](https://github.com/chdb-io/chdb-dotnet), [Zig](https://github.com/chdb-io/chdb-zig), and experimental [WebAssembly](https://wasm.chdb.io/). Check the [capability matrix](https://github.com/chdb-io/chdb#language-binding-capability-matrix) for published versions, source-only features and platform limits. The [Go guide](https://clickhouse.com/docs/chdb/install/go#static-linking) covers its experimental static build.
+
## How do I get started?
* If you're using [Go](https://clickhouse.com/docs/chdb/install/go), [Rust](https://clickhouse.com/docs/chdb/install/rust), [NodeJS](https://clickhouse.com/docs/chdb/install/nodejs), [Bun](https://clickhouse.com/docs/chdb/install/bun) or [C and C++](https://clickhouse.com/docs/chdb/install/c), take a look at the corresponding language pages.
* If you're using Python, see the [getting started developer guide](https://clickhouse.com/docs/chdb/getting-started) or the [chDB on-demand course](https://learn.clickhouse.com/user_catalog_class/show/1901178).
@@ -519,41 +521,34 @@ To learn more about how to use it, see the following developer guides:
How to install and use chDB with Bun runtime
-chDB-bun provides experimental FFI (Foreign Function Interface) bindings for chDB, enabling you to run ClickHouse queries directly in your Bun applications with zero external dependencies.
+chDB-bun is an experimental FFI binding. This guide builds source release `v2.0.0` with stable core `v26.11.1`; npm still serves `1.0.4`. The binding has no binary-safe Arrow, result streaming or native parameter API.
## Installation
-First, install the required system dependencies:
-
-#### Install libchdb
-```bash
-curl -sL https://lib.chdb.io | bash
-```
-
-#### Install build tools
-You'll need either `gcc` or `clang` installed on your system:
+Install Bun and Clang on macOS or Linux. The build below downloads [stable core v26.11.1](https://github.com/chdb-io/chdb-core/releases/tag/v26.11.1).
-```bash
-# Install from the GitHub repository
-bun add github:chdb-io/chdb-bun
+Clone the tag and update its downloader's engine pin before building:
-# Or clone and build locally
-git clone https://github.com/chdb-io/chdb-bun.git
+```bash
+git clone --branch v2.0.0 --depth 1 https://github.com/chdb-io/chdb-bun.git
cd chdb-bun
+sed -i.bak 's/^LATEST_RELEASE=.*/LATEST_RELEASE=v26.11.1/' lib/update_libchdb.sh
bun install
bun run build
```
+Run the examples from this directory. A `bun add github:...` alone does not build the native wrapper.
+
## Usage
-chDB-bun supports two query modes: ephemeral queries for one-time operations and persistent sessions for maintaining database state.
+The native wrapper reuses one connection for the active path. Switching paths replaces it; `Session` objects do not own independent connections. `cleanup()` closes it and deletes the data directory.
### Ephemeral queries
For simple, one-off queries that don't require persistent state:
@@ -562,7 +557,7 @@ For simple, one-off queries that don't require persistent state:
// Basic query
const result = query("SELECT version()", "CSV");
-console.log(result); // "23.10.1.1"
+console.log(result); // Version of the loaded native engine
// Query with different output formats
const jsonResult = query("SELECT 1 as id, 'Hello' as message", "JSON");
@@ -585,48 +580,45 @@ For complex operations that require maintaining state across queries:
// Create a session with persistent storage
const sess = new Session('./chdb-bun-tmp');
-try {
- // Create a database and table
- sess.query(`
+// Create a database and table
+sess.query(`
CREATE DATABASE IF NOT EXISTS mydb;
CREATE TABLE IF NOT EXISTS mydb.users (
id UInt32,
name String,
email String
) ENGINE = MergeTree() ORDER BY id
- `, "CSV");
+`, "CSV");
- // Insert data
- sess.query(`
+// Insert data
+sess.query(`
INSERT INTO mydb.users VALUES
(1, 'Alice', 'alice@example.com'),
(2, 'Bob', 'bob@example.com'),
(3, 'Charlie', 'charlie@example.com')
- `, "CSV");
+`, "CSV");
- // Query the data
- const users = sess.query("SELECT * FROM mydb.users ORDER BY id", "JSON");
- console.log("Users:", users);
+// Query the data
+const users = sess.query("SELECT * FROM mydb.users ORDER BY id", "JSON");
+console.log("Users:", users);
- // Create and use custom functions
- sess.query("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'Hello chDB'", "CSV");
- const greeting = sess.query("SELECT hello() as message", "Pretty");
- console.log(greeting);
+// Create and use custom functions
+sess.query("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'Hello chDB'", "CSV");
+const greeting = sess.query("SELECT hello() as message", "Pretty");
+console.log(greeting);
- // Aggregate queries
- const stats = sess.query(`
+// Aggregate queries
+const stats = sess.query(`
SELECT
COUNT(*) as total_users,
MAX(id) as max_id,
MIN(id) as min_id
FROM mydb.users
- `, "JSON");
- console.log("Statistics:", stats);
+`, "JSON");
+console.log("Statistics:", stats);
-} finally {
- // Always cleanup the session to free resources
- sess.cleanup(); // This deletes the database files
-}
+// Keep the persistent database path. sess.cleanup() recursively deletes it;
+// use cleanup() only when you intentionally want to discard this data.
```
---
@@ -964,49 +956,66 @@ cleanup:
How to install and use chDB with Go
-chDB-go provides Go bindings for chDB, enabling you to run ClickHouse queries directly in your Go applications with zero external dependencies.
+chDB-go runs ClickHouse queries in-process. The default binding loads a shared native library without cgo; static linking is opt-in.
## Installation
-
-
+Install the stable module (Go 1.21+):
+
+```bash
+go get github.com/chdb-io/chdb-go/v2@latest
+```
+
+Install [stable core v26.11.1](https://github.com/chdb-io/chdb-core/releases/tag/v26.11.1) for your platform and set `CHDB_LIB_PATH` to the absolute path of `libchdb.so`. Alternatively, import the separate [embedded-library module](https://github.com/chdb-io/chdb-go/tree/main/lib/embedded); it extracts its packaged shared library at runtime and is not static linking.
-First, install the chDB library:
+For the optional CLI:
```bash
-curl -sL https://lib.chdb.io | bash
+go install github.com/chdb-io/chdb-go/v2@latest
```
-
-
+### Optional Arrow and native parameter APIs
+Typed Arrow input, batch results and bulk insert require a separate RC module, Go 1.23+, cgo and core `v26.11.1`:
+
+```bash
+go get github.com/chdb-io/chdb-go/v2/arrow@latest
+```
+
+The Arrow module selects compatible root bindings with native named parameters (`{name:Type}`, including `sql.Named`). Positional `database/sql` arguments are interpolated; transactions and prepared statements are unsupported.
+
+Arrow uses C Data/C Stream with copies into native-owned input buffers. See the [Arrow guide](https://github.com/chdb-io/chdb-go/blob/main/v2/arrow/README.md) for types and lifetimes. If an embedded engine is older, point `CHDB_LIB_PATH` at the stable library above.
-Install the Go package:
+### Static linking (experimental)
+Static builds require cgo and a C toolchain on Linux or macOS (amd64/arm64). Install the static engine module:
```bash
-go install github.com/chdb-io/chdb-go@latest
+go get go.chdb.io/chdb/static@latest
```
-Or add it to your `go.mod`:
+Add this import to the application:
+
+```go
+import _ "go.chdb.io/chdb/static"
+```
```bash
-go get github.com/chdb-io/chdb-go
+CGO_ENABLED=1 go build -tags chdb_static -o myapp .
```
-
-
+The module supplies the engine and selects compatible root bindings. Do not combine it with `lib/embedded`; `CHDB_LIB_PATH` cannot override a statically linked engine.
## Usage
### Command line interface
-chDB-go includes a CLI for quick queries:
+chDB-go includes a CLI for quick queries. After `go install`, use `chdb-go` if Go's binary directory is on `PATH`; `./chdb-go` only applies when you built the executable in the current directory.
```bash
# Simple query
-./chdb-go "SELECT 123"
+chdb-go "SELECT 123"
# Interactive mode
-./chdb-go
+chdb-go
# Interactive mode with persistent storage
-./chdb-go --path /tmp/chdb
+chdb-go --path /tmp/chdb
```
### Go Library - quick start
@@ -1018,7 +1027,7 @@ package main
import (
"fmt"
- "github.com/chdb-io/chdb-go/chdb"
+ "github.com/chdb-io/chdb-go/v2/chdb"
)
func main() {
@@ -1027,6 +1036,7 @@ func main() {
if err != nil {
panic(err)
}
+ defer result.Free()
fmt.Println(result)
}
```
@@ -1039,7 +1049,7 @@ package main
import (
"fmt"
- "github.com/chdb-io/chdb-go/chdb"
+ "github.com/chdb-io/chdb-go/v2/chdb"
)
func main() {
@@ -1048,37 +1058,48 @@ func main() {
if err != nil {
panic(err)
}
- defer session.Cleanup()
+ defer session.Close() // Preserve /tmp/chdb-data; Cleanup() deletes the data path.
// Create database and table
- _, err = session.Query(`
- CREATE DATABASE IF NOT EXISTS testdb;
+ created, err := session.Query("CREATE DATABASE IF NOT EXISTS testdb")
+ if err != nil {
+ panic(err)
+ }
+ if created != nil {
+ created.Free()
+ }
+
+ table, err := session.Query(`
CREATE TABLE IF NOT EXISTS testdb.test_table (
id UInt32,
name String
) ENGINE = MergeTree() ORDER BY id
- `, "")
-
+ `)
if err != nil {
panic(err)
}
+ if table != nil {
+ table.Free()
+ }
// Insert data
- _, err = session.Query(`
+ inserted, err := session.Query(`
INSERT INTO testdb.test_table VALUES
(1, 'Alice'), (2, 'Bob'), (3, 'Charlie')
- `, "")
-
+ `)
if err != nil {
panic(err)
}
+ if inserted != nil {
+ inserted.Free()
+ }
// Query data
result, err := session.Query("SELECT * FROM testdb.test_table ORDER BY id", "Pretty")
if err != nil {
panic(err)
}
-
+ defer result.Free()
fmt.Println(result)
}
```
@@ -1092,7 +1113,7 @@ package main
import (
"database/sql"
"fmt"
- _ "github.com/chdb-io/chdb-go/chdb/driver"
+ _ "github.com/chdb-io/chdb-go/v2/chdb/driver"
)
func main() {
@@ -1118,6 +1139,9 @@ func main() {
}
fmt.Printf("Count: %d\n", count)
}
+ if err := rows.Err(); err != nil {
+ panic(err)
+ }
}
```
@@ -1130,7 +1154,7 @@ package main
import (
"fmt"
"log"
- "github.com/chdb-io/chdb-go/chdb"
+ "github.com/chdb-io/chdb-go/v2/chdb"
)
func main() {
@@ -1139,10 +1163,10 @@ func main() {
if err != nil {
log.Fatal(err)
}
- defer session.Cleanup()
+ defer session.Close() // Preserve /tmp/chdb-stream; Cleanup() deletes the data path.
// Execute a streaming query for large dataset
- streamResult, err := session.QueryStreaming(
+ streamResult, err := session.QueryStream(
"SELECT number, number * 2 as double FROM system.numbers LIMIT 1000000",
"CSV",
)
@@ -1224,7 +1248,7 @@ Instructions for how to get setup with chDB are available below for the followin
How to install and use chDB with Node.js
-chDB-node provides Node.js bindings for chDB, enabling you to run ClickHouse queries directly in your Node.js applications with zero external dependencies.
+`chdb@3.6.0` embeds core `26.11.1` for Node.js 18+ on Linux glibc and macOS (x64/arm64). It supports sync/async queries, native named parameters and result streams. The optional `apache-arrow` peer enables typed input, batch results and bulk insert; see the [Arrow guide](https://github.com/chdb-io/chdb-node/blob/v3.6.0/docs/arrow.md) for ownership and type limits. Direct Arrow may copy buffers; `format: 'arrow'` / `toArrow()` uses IPC. The ClickHouse-client adapter and Durable APIs remain experimental.
## Installation
```bash
@@ -1302,8 +1326,8 @@ try {
console.log("User Statistics:", stats);
} finally {
- // Always cleanup the session
- session.cleanup(); // This deletes the database files
+ // Close the native connection. A caller-supplied database path is preserved.
+ session.cleanup();
}
```
@@ -2050,18 +2074,23 @@ sess.close()
**URL:** https://clickhouse.com/docs/chdb/install/rust
-How to install and use chDB Rust bindingsd
+How to install and use chDB Rust bindings
-chDB-rust provides experimental FFI (Foreign Function Interface) bindings for chDB, enabling you to run ClickHouse queries directly in your Rust applications with zero external dependencies.
+chDB-rust provides FFI (Foreign Function Interface) bindings for in-process ClickHouse queries without a separate database server. The crate has Rust dependencies and needs a compatible native chDB library at link or runtime.
## Installation
-### Install libchdb
-Install the chDB library:
+### Add the crate
+Add the experimental `2.2.1` crate to `Cargo.toml`:
-```bash
-curl -sL https://lib.chdb.io | bash
+```toml
+[dependencies]
+chdb-rust = "=2.2.1"
```
+On Linux/macOS x86_64 and aarch64, the build uses a local `libchdb` and matching header or downloads stable core `v26.11.1`. Clang/libclang is required for FFI generation. Set `CHDB_LIB_DIR` and `CHDB_INCLUDE_DIR` to select a local engine. Distributed dynamic binaries need a runtime library path or rpath; enable the `static` feature to link the engine into the executable.
+
+The default `arrow` feature uses Arrow 59 for direct batch results, reader registration and bulk insert. Direct Arrow may copy buffers; IPC output remains separate. See the [Arrow guide](https://github.com/chdb-io/chdb-rust/blob/v2.2.1/docs/arrow.md) for types and ownership. Native named parameters work across queries, streams and inserts. `durable` and `durable-s3` are opt-in.
+
## Usage
chDB Rust provides both stateless and stateful query execution modes.
@@ -2079,7 +2108,7 @@ fn main() -> Result<(), Box> {
)?;
println!("ClickHouse version: {}", result.data_utf8()?);
- // Query with CSV file
+ // Query a CSV file if data.csv exists in the working directory
let result = execute(
"SELECT * FROM file('data.csv', 'CSV')",
Some(&[Arg::OutputFormat(OutputFormat::JSONEachRow)])
@@ -2091,7 +2120,7 @@ fn main() -> Result<(), Box> {
```
### Stateful usage (Sessions)
-For queries requiring persistent state like databases and tables:
+For queries that maintain state across calls, the example below uses a temporary directory. Add `tempdir = "0.3.7"` to your application's dependencies. The opt-in `with_auto_cleanup(true)` deletes that directory after the final handle closes; use a caller-owned path without auto-cleanup if the data must survive the process.
```rust
use chdb_rust::{
@@ -2110,29 +2139,25 @@ fn main() -> Result<(), Box> {
let session = SessionBuilder::new()
.with_data_path(tmp.path())
.with_arg(Arg::LogLevel(LogLevel::Debug))
- .with_auto_cleanup(true) // Cleanup on drop
+ .with_auto_cleanup(true) // Delete this temporary data directory on drop
.build()?;
// Create database and table
+ session.execute("CREATE DATABASE demo", None)?;
session.execute(
- "CREATE DATABASE demo; USE demo",
- Some(&[Arg::MultiQuery])
- )?;
-
- session.execute(
- "CREATE TABLE logs (id UInt64, msg String) ENGINE = MergeTree() ORDER BY id",
+ "CREATE TABLE demo.logs (id UInt64, msg String) ENGINE = MergeTree() ORDER BY id",
None,
)?;
// Insert data
session.execute(
- "INSERT INTO logs (id, msg) VALUES (1, 'Hello'), (2, 'World')",
+ "INSERT INTO demo.logs (id, msg) VALUES (1, 'Hello'), (2, 'World')",
None,
)?;
// Query data
let result = session.execute(
- "SELECT * FROM logs ORDER BY id",
+ "SELECT * FROM demo.logs ORDER BY id",
Some(&[Arg::OutputFormat(OutputFormat::JSONEachRow)]),
)?;
@@ -2158,11 +2183,8 @@ cargo build
cargo test
```
-### Development dependencies
-The project includes these development dependencies:
-- `bindgen` (v0.70.1) - Generate FFI bindings from C headers
-- `tempdir` (v0.3.7) - Temporary directory handling in tests
-- `thiserror` (v1) - Error handling utilities
+### Dependency categories
+The crate uses `bindgen` to generate FFI bindings during its build and `thiserror` as a regular dependency. `tempdir` is only a development dependency of the crate, so applications using the temporary-session example above must add it explicitly.
## Error handling
chDB Rust provides comprehensive error handling through the `Error` enum:
@@ -2170,9 +2192,10 @@ chDB Rust provides comprehensive error handling through the `Error` enum:
```rust
use chdb_rust::{execute, error::Error};
-match execute("SELECT 1", None) {
+fn main() {
+ match execute("SELECT 1", None) {
Ok(result) => {
- println!("Success: {}", result.data_utf8()?);
+ println!("Success: {}", result.data_utf8_lossy());
},
Err(Error::QueryError(msg)) => {
eprintln!("Query failed: {}", msg);
@@ -2186,6 +2209,7 @@ match execute("SELECT 1", None) {
Err(e) => {
eprintln!("Other error: {}", e);
}
+ }
}
```
@@ -13132,11 +13156,12 @@ An Arrow `Table` holds batches of columnar data; a `RecordBatchReader` supplies
| --- | --- |
| Query an in-memory `pyarrow.Table` or one-shot `RecordBatchReader` | This guide's [`Python(arrow_table)` example](#querying-apache-arrow); [core reader behavior tests](https://github.com/chdb-io/chdb-core/blob/main/tests/test_arrow_c_stream_protocol.py) for one-shot streams |
| Install chDB and use the existing `ArrowTable` or streaming result formats | [Python installation and examples](https://clickhouse.com/docs/chdb/install/python); [Python API reference](https://clickhouse.com/docs/chdb/api/python) |
+| Use direct typed results, incremental batches, scoped registration or bulk insert without IPC | [Python 4.5.1 direct Arrow guide](https://github.com/chdb-io/chdb/blob/v4.5.1/docs/python-arrow-direct.md): `query_arrow`, `query_arrow_batches`, and `chdb.arrow.connect()`; requires core 26.11.1+ |
| Use Arrow with the pandas-like DataStore layer | [DataStore I/O](https://clickhouse.com/docs/chdb/datastore/io) and [class reference](https://clickhouse.com/docs/chdb/datastore/class-reference) — a separate API from `Python(tbl)` |
| Use Arrow Database Connectivity (ADBC), the standard database-driver API for Arrow results or bulk ingest | [ADBC installation and usage](https://clickhouse.com/docs/chdb/install/adbc); ordinary ADBC `BindStream` passes query parameters, not a temporary SQL table like `Python(tbl)` |
| Work on the native Arrow contract or C examples | [Binding contract](https://github.com/chdb-io/chdb-core/blob/main/docs/NATIVE_ARROW_BINDING_CONTRACT.md), [input example](https://github.com/chdb-io/chdb-core/blob/main/examples/chdbArrowTest.c), [query-output example](https://github.com/chdb-io/chdb-core/blob/main/examples/chdbArrowQueryTest.c) |
-This is the Python binding's Arrow documentation entry point. `ArrowTable`/`Arrow` result formats serialize Arrow data using its Inter-Process Communication (IPC) format; the pandas-like DataStore Arrow interface is another API. Consult their linked guides rather than assuming identical streaming or ownership behavior.
+This is the Python binding's Arrow documentation entry point. `ArrowTable`/`Arrow` result formats serialize Arrow data using its Inter-Process Communication (IPC) format. Python 4.5.1 also exposes direct C Data results through `query_arrow` and `query_arrow_batches`; conversion may still copy data, and partial batch streams must be closed. The pandas-like DataStore Arrow interface and ADBC driver are separate APIs. Consult their linked guides rather than assuming identical streaming or ownership behavior.
## Setup
Let's first create a virtual environment:
diff --git a/llms.txt b/llms.txt
index 76f90f56afc..3a5906ffb13 100644
--- a/llms.txt
+++ b/llms.txt
@@ -20,7 +20,9 @@ Things to remember when using chDB:
- [Go](https://clickhouse.com/docs/chdb/install/go)
- [Rust](https://clickhouse.com/docs/chdb/install/rust)
- [C and C++](https://clickhouse.com/docs/chdb/install/c)
-- [WebAssembly — chDB in the browser](https://wasm.chdb.io/)
+- [Experimental WebAssembly — chDB in the browser](https://wasm.chdb.io/) (demo currently pins `chdb-wasm@0.3.0`; npm also publishes `0.4.0`)
+
+The [capability matrix](https://github.com/chdb-io/chdb#language-binding-capability-matrix) lists published versions, RCs and source-only features, including Java/JDBC, Ruby, .NET and Zig. Use stable core 26.11.1 for native installs unless a package pins its engine. Direct Arrow can still copy buffers; Go's Arrow and [static build](https://clickhouse.com/docs/chdb/install/go#static-linking) require separate opt-in modules.
## Documentation