Skip to main content

Requirements

  • Python 3.8+
  • Supported platforms: macOS and Linux (x86_64 and ARM64)

Installation

Usage

Command line interface

Run SQL queries directly from the command line:

Basic python usage

Connection-based API (recommended)

For better resource management and performance:

Data input methods

File-based data sources

chDB supports 70+ data formats for direct file querying:

Output format examples

DataFrame operations

Legacy DataFrame API

Stateful sessions

Sessions maintain query state across multiple operations, enabling complex workflows:

Advanced session features

See also: test_stateful.py.

Python DB-API 2.0 interface

Standard database interface for compatibility with existing Python applications:

Python user-defined functions (UDF)

chDB supports native in-process Python UDFs with typed arguments, automatic type inference, and configurable NULL/exception handling.
For the complete guide covering registration methods, type system, NULL handling, exception handling, and DateTime support, see the Python UDF guide. For the full API reference, see the Python UDF API reference. The older @chdb_udf decorator is still available but superseded by this API — see Legacy API.

Streaming query processing

Process large datasets with constant memory usage:

Python table engine

Query Pandas DataFrames

Custom data sources with PyReader

Implement custom data readers for specialized data sources:

Performance and optimization

Benchmarks

chDB consistently outperforms other embedded engines:
  • DataFrame operations: 2-5x faster than traditional DataFrame libraries for analytical queries
  • Parquet processing: Competitive with leading columnar engines
  • Memory efficiency: Lower memory footprint than alternatives
More benchmark result details

Performance tips

GitHub repository

Last modified on July 30, 2026