Installation
Step 1: Install libchdb
First, install the chDB library:Step 2: Install chdb-go
Install the Go package:go.mod:
Usage
Command line interface
chDB-go includes a CLI for quick queries:Go Library - quick start
Stateless queries
For simple, one-off queries:Stateful queries with session
For complex queries with persistent state:SQL driver interface
chDB-go implements Go’sdatabase/sql interface:
Query streaming for large datasets
For processing large datasets that don’t fit in memory, use streaming queries:- Memory efficient - Process large datasets without loading everything into memory
- Real-time processing - Start processing data as soon as first chunk arrives
- Cancellation support - Can cancel long-running queries with
Cancel() - Error handling - Check for errors during streaming with
Error()
API documentation
chDB-go provides both high-level and low-level APIs:- High-Level API Documentation - Recommended for most use cases
- Low-Level API Documentation - For advanced use cases requiring fine-grained control
System requirements
- Go 1.21 or later
- Compatible with Linux, macOS