Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 8 min read How-to mediumAdept

An introduction to Ibis

Ibis is an open-source Python dataframe library that compiles lazy, composable relational expressions to SQL and runs them on 20+ backends, including ClickHouse. The walkthrough loads the nycflights13 dataset into a local ClickHouse server and covers casting columns without altering the stored schema, grouping and aggregating with agg and topk, inspecting generated SQL with ibis.to_sql, and composing stored expressions with filter, union and argmin/argmax. It ends by querying an existing remote table on the ClickHouse Playground. The generated SQL works but nests more subqueries than hand-written SQL would.

Assumes: Python basicsSQL aggregationdataframe concepts

Related posts

  • Querying Pandas DataFrames with ClickHouse

    ClickHouse mediumAdept

    chDB, an embedded Python library built on the ClickHouse engine, can run SQL directly against Pandas DataFrames through the chdb.dataframe module. DataFrames are passed as named parameters and referenced in SQL as __name__. The walkthrough uses Kaggle Canadian house-price data to show aggregation with GROUP BY ALL, joining two DataFrames, re-querying the resulting chDB Table via __table__, and converting results back with to_pandas(). It needs pandas and pyarrow installed, and string columns come back as bytes, so filters must compare against values like b"Ontario".

  • Welcome, chDB

    ClickHouse mediumAdept

    chDB is a community-built embedded SQL OLAP engine that packages ClickHouse as an in-process Python module, similar in spirit to DuckDB, for local analytics, ETL and exploration without running a server. Instead of shelling out to clickhouse-local via pipes, which adds 10–50 ms of process startup per query and copies results, chDB hooks into ClickHouse's read/write buffers and exchanges data through MemoryView. Examples show querying Parquet and gzipped CSV on S3 with schema inference, returning results as CSV, Pandas DataFrames or Arrow tables, and running SQL directly over DataFrames. Bindings for Rust, Node.js and Go, persistent sessions backed by MergeTree, UDFs and ARM64 support are in progress or recently added.

  • ClickHouse and Power BI, columnar end to end: the Arrow Flight connector is in public preview

    ClickHouse mediumAdept

    ClickHouse's new Power BI connector, now in public preview, talks Arrow Flight SQL over TLS-encrypted gRPC. Data stays columnar end to end instead of being converted to rows and back as the ODBC path does, and the Power BI service connects directly, so no on-premises gateway or driver install is needed. In a 10M-row, 20-column import benchmark, refresh took 278 s versus 390 s for ODBC plus a gateway. ClickHouse spent about 5 s on the query instead of 150 s and used roughly 6x less CPU. The connector supports query folding and exact Decimal/UInt64 types, works best in Import mode (DirectQuery is still maturing), and needs ClickHouse 26.5+ or a support request on ClickHouse Cloud.

  • Retail data, reimagined: How Increff rebuilt its BI platform with ClickHouse

    ClickHouse mediumAdept

    Increff, a retail SaaS provider for brands like Puma and Adidas, replaced a BI stack of Pandas transformations, a serverless SQL warehouse and Superset after a client with 5x larger data caused query slowdowns and concurrency limits. The rebuilt platform uses DuckDB for most transformations, ClickHouse Cloud for warehousing and Redis caching for dashboards. It handles around a billion records at the same performance as before, with sub-second queries and 70–80% shorter data preparation times. Further tuning included a star schema with daily/weekly/monthly aggregated fact tables, time-based partitioning, LowCardinality and unsigned integer types, Jinja-templated Superset queries to drop unneeded joins, and explicit PREWHERE clauses.

  • Announcing chDB 4: write Pandas, run ClickHouse, now on Hex

    ClickHouse mediumAdept

    chDB 4 adds DataStore, a Pandas-compatible API that records operations lazily as a chain of LazyOps, then compiles them into ClickHouse SQL with filter pushdown, column pruning and limit propagation, executing in-process on the ClickHouse engine. A query planner splits pipelines into segments when an operation has no ClickHouse equivalent, handing data to Pandas and back via memoryview and the Python() table function with near-zero-copy exchange for fixed-width columns. Pandas segments act as optimization barriers, so Pandas-only operations are best placed late in the pipeline. Row-ID tracking preserves source ordering, with an optional performance mode that skips it. Automatic caching serves notebook workflows, and NaN/NULL, string sort order and integer overflow semantics are documented differences from Pandas. It ships pre-installed in Hex notebooks.

The quest for software engineering knowledge.

Look:
Layout: