CI

chdb-io/chdb

Developer tools
2.9Kย stars Quality 72 Trend 79Apache-2.0

chDB is an in-process OLAP SQL Engine ๐Ÿš€ powered by ClickHouse

Overview

๐ŸŽ‰ New: chDB-Wasm โ€” the complete ClickHouse engine compiled to WebAssembly. Run SQL in your browser, no server, no install โ†’ wasm.chdb.io Contributing? See CONTRIBUTING.md โ€” setup, the modify-then-test workflow, PR conventions, CI, and releases. AGENTS.md (kept short and stays in agent context) captures the chdb-ds design and testing principles. chDB is an in-process SQL OLAP Engine powered by ClickHouse [^1] For more details: The birth of chDB * - Use familiar pandas syntax with ClickHouse performance * - chDB-Wasm compiles the full engine to WASM; try it live at wasm.chdb.io * In-process SQL OLAP Engine, powered by ClickHouse * No need to install ClickHouse * Minimized data copy from C++ to Python with python memoryview * Input&Output support Parquet, CSV, JSON, Arrow, ORC and 60+more formats * Support Python DB API 2.

README

chDB

chDB is an in-process SQL OLAP Engine powered by ClickHouse [^1] For more details: The birth of chDB

Features

  • ๐Ÿผ Pandas-compatible DataStore API - Use familiar pandas syntax with ClickHouse performance
  • ๐ŸŒ Runs in the browser via WebAssembly - chDB-Wasm compiles the full engine to WASM; try it live at wasm.chdb.io
  • In-process SQL OLAP Engine, powered by ClickHouse
  • No need to install ClickHouse
  • Minimized data copy from C++ to Python with python memoryview
  • Input&Output support Parquet, CSV, JSON, Arrow, ORC and 60+more formats
  • Support Python DB API 2.0

Get Started on Hex

  • ๐Ÿ“– Getting Started Tutorial โ€” set up your first connection
  • ๐Ÿš€ Extended 30-day Hex Trial โ€” full access to ClickHouse integrations

Arch

Installation

Currently, chDB supports Python 3.9+ on macOS and Linux (x86_64 and ARM64).

pip install chdb

No install at all: open wasm.chdb.io and run SQL against the WebAssembly build (chDB-Wasm) right in your browser.

Install ADBC support with Python 3.10 or later:

pip install "chdb[adbc]"

DataStore provides a familiar pandas-like API with automatic SQL generation and ClickHouse performance. Write pandas code, get SQL performance - no learning curve required.

Quick Start (30 seconds)

Just change your import - use the pandas API you already know:

import datastore as pd  # That's it! Use pandas API as usual

# Create a DataFrame - works exactly like pandas
df = pd.DataFrame({
    'name': ['Alice', 'Bob', 'Charlie', 'Diana'],
    'age': [25, 30, 35, 28],
    'city': ['NYC', 'LA', 'NYC', 'LA']
})

# Filter with familiar pandas syntax
result = df[df['age'] > 26]
print(result)
#       name  age city
# 1      Bob   30   LA
# 2  Charlie   35  NYC
# 3    Diana   28   LA

# GroupBy works too
print(df.groupby('city')['age'].mean())
# city
# LA     29.0
# NYC    30.0

โœจ Zero code changes required. All operations are lazy - theyโ€™re recorded and compiled into optimized SQL, executed only when results are needed.

Why DataStore?

Feature pandas DataStore
API โœ… Familiar โœ… Same pandas API
Large datasets โŒ Memory limited โœ… SQL-optimized
Learning curve โœ… Easy โœ… None - same syntax
Performance โŒ Single-threaded โœ… ClickHouse engine

Architecture

DataStore uses lazy evaluation with dual-engine execution:

  1. Lazy Operation Chain: Operations are recorded, not executed immediately
  2. Smart Engine Selection: QueryPlanner routes each segment to optimal engine (chDB for SQL, Pandas for complex ops)
  3. Intermediate Caching: Results cached at each step for fast iterative exploration

Working with Files

from datastore import DataStore

# Load any file format
ds = DataStore.from_file("data.parquet")  # or CSV, JSON, ORC...

# Explore your data
print(ds.head())       # Preview first 5 rows
print(ds.shape)        # (rows, columns)
print(ds.columns)      # Column names

# Build queries with method chaining
result = (ds
    .select("product", "revenue", "date")
    .filter(ds.revenue > 1000)
    .sort("revenue", ascending=False)
    .head(10))

print(result)

Query Any Data Source

from datastore import DataStore

# S3 (with anonymous access)
ds = DataStore.uri("s3://bucket/data.parquet?nosign=true")

# MySQL
ds = DataStore.uri("mysql://user:pass@localhost:3306/mydb/users")

# PostgreSQL
ds = DataStore.uri("postgresql://user:pass@localhost:5432/mydb/products")

# And more: SQLite, MongoDB, ClickHouse, HDFS, Azure, GCS...

Pandas API Coverage

DataStore implements comprehensive pandas compatibility:

Category Coverage
DataFrame methods 209 methods
Series.str accessor 56 methods
Series.dt accessor 42+ methods
ClickHouse SQL functions 334 functions
# All these pandas methods work:
df.drop(columns=['unused'])
df.fillna(0)
df.assign(revenue=lambda x: x['price'] * x['quantity'])
df.sort_values('revenue', ascending=False)
df.groupby('category').agg({'revenue': 'sum', 'quantity': 'mean'})
df.merge(other_df, on='id')
df.pivot_table(values='sales', index='date', columns='product')
# ... and 200+ more

String and DateTime Operations

# String operations via .str accessor
ds['name'].str.upper()
ds['email'].str.contains('@gmail')
ds['text'].str.replace('old', 'new')

# DateTime operations via .dt accessor  
ds['date'].dt.year
ds['date'].dt.month
ds['timestamp'].dt.hour

Documentation


SQL API

For users who prefer SQL or need advanced ClickHouse features:

Run in command line

python3 -m chdb SQL [OutputFormat]

python3 -m chdb "SELECT 1,'abc'" Pretty

Data Input

The following methods are available to access on-disk and in-memory data formats:

For more examples, see examples and tests.

Demos and Examples

Benchmark

Documentation

AI Coding Agent Skills

chdb provides two AI Skills that teach AI coding agents (Cursor, Claude Code, Codex, etc.) how to use chdb:

  • chdb-datastore โ€” Drop-in pandas replacement. import chdb.datastore as pd, keep existing code unchanged, get ClickHouse performance.
  • chdb-sql โ€” In-process ClickHouse SQL. Run chdb.query(), use Session for stateful pipelines, query any file or database with SQL.

Install both so your AI assistant can write correct chdb code out of the box:

curl -sL https://raw.githubusercontent.com/chdb-io/chdb/main/install_skill.sh | bash

For project-level installation (git-committable, shared with your team):

curl -sL https://raw.githubusercontent.com/chdb-io/chdb/main/install_skill.sh | bash -s -- --project

Agent Framework Integrations

chdb.agents ships an agent-safe tool surface (ChDBTool: read-only by default, capped results, errors returned as envelopes the model can self-correct from), and every framework binding below is a thin shell over it โ€” same tool names, descriptions, and behavior everywhere:

  • LlamaIndex โ€” pip install llama-index-tools-chdb, then ChDBToolSpec().to_tool_list().
  • Pydantic AI โ€” pip install pydantic-ai-chdb, then Agent(..., capabilities=[ChDBCapability()]); typed engine errors become ModelRetry.
  • smolagents โ€” built in: from chdb.agents.smolagents import chdb_smol_tools (requires pip install smolagents).
  • MCP โ€” mcp-clickhouse runs chdb in-process (CHDB_ENABLED=true) for any MCP-speaking agent.
  • Node.js โ€” the chdb npm package ships Vercel AI SDK (chdb/ai-sdk) and Mastra (chdb/mastra) adapters.

Events

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

See CONTRIBUTING.md for setup, the modify-then-test workflow, PR & commit conventions, CI, and releases. Things you can help with:

  • [ ] Help test and report bugs
  • [ ] Help improve documentation
  • [ ] Help improve code quality and performance

Bindings

We welcome bindings for other languages, please refer to bindings for more details.

Version Guide

Please refer to VERSION-GUIDE.md for more details.

Paper

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.

Data date: 2026-09-28

Capability / dimension Pythonchdb 4.4.0 C / C++core 26.7.3 Node.jschdb 3.4.0 Gov2.2.0 Rust1.3.1 published / 2.0 main Java1.0.0-SNAPSHOT Ruby0.1.0 .NET0.0.3.69 Bun1.1.0 source Zig0.0.9 WASM0.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.

License

Apache 2.0, see LICENSE for more information.

Acknowledgments

chDB is mainly based on ClickHouse [^1] for trade mark and other reasons, I named it chDB.

Contact

[^1]: ClickHouseยฎ is a trademark of ClickHouse Inc. All trademarks, service marks, and logos mentioned or depicted are the property of their respective owners. The use of any third-party trademarks, brand names, product names, and company names does not imply endorsement, affiliation, or association with the respective owners.

View this README on GitHub

Recommended Tools

Try a different keyword or remove a filter.

Install

npx skillfish add chdb-io/chdb