chDB is an in-process OLAP SQL Engine powered by ClickHouse, enabling users to embed a powerful analytical database directly within their Python applications. It allows running SQL queries on various data formats (Parquet, CSV, JSON, Pandas DataFrames) without needing a separate database server. Currently at version 4.1.6, chDB maintains an active development and release cadence, frequently adding features and improvements.
pip install chdbVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to execute a basic SQL query using `chdb.query` and receive the results directly as a Pandas DataFrame. It also shows how to query an existing Pandas DataFrame using ClickHouse SQL syntax via the `python(df_name)` table function.
Monitor memory usage for complex queries. For extremely large datasets, consider pre-processing or using a full ClickHouse server. Optimize SQL queries to reduce memory footprint where possible.
Design your application with chDB as a single-user, embedded analytical tool. Implement access control and resource management at the application layer if necessary, or opt for a full ClickHouse server for multi-tenant scenarios.
Be mindful of chained DataFrame operations. For large datasets, consider explicitly performing operations that avoid intermediate materialization or breaking down complex chains into optimized SQL queries where possible.
Review your code for any direct references to `chdb-core` components. Ensure your environment correctly resolves dependencies after upgrading to 4.1.0 or later.
Upgrade to chDB version 4.1.0 or newer to benefit from the fix for exit-related crashes.
Ensure you are using chDB version 4.1.4 or newer to avoid potential module import issues after package upgrades.
Reduce the dataset size, process data in smaller chunks, or increase the available memory for the Python process. For datasets exceeding available RAM, consider using a ClickHouse server which can spill to disk.
Install the missing dependency using pip: `pip install pandas` or `pip install pyarrow`.
Review the SQL query for typos, ensure correct ClickHouse SQL syntax, use backticks (`) to escape reserved keywords if used as identifiers, or check the chDB/ClickHouse documentation for supported functions and versions.
Check if the database exists before attempting to create it (e.g., `CREATE DATABASE IF NOT EXISTS default;`), or use a temporary in-memory session if persistence is not required for that specific operation.
Enable the `engine_file_allow_create_multiple_files` setting before inserting to allow ClickHouse to create new files for each insert: `chdb.query("SET engine_file_allow_create_multiple_files = 1;")` before your INSERT statements.