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.
Installation
Install libchdb
Install the chDB library:
Usage
chDB Rust provides both stateless and stateful query execution modes.
Stateless usage
For simple queries without persistent state:
Stateful usage (Sessions)
For queries requiring persistent state like databases and tables:
Building and testing
Build the project
Run tests
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
Error handling
chDB Rust provides comprehensive error handling through the Error enum:
GitHub repository
You can find the GitHub repository for the project at chdb-io/chdb-rust. Last modified on July 2, 2026