Skip to main content
Integration with the SeaweedFS catalog works with Iceberg tables only.
ClickHouse supports integration with multiple catalogs (Unity, Glue, REST, Polaris, etc.). This guide will walk you through the steps to query your data using ClickHouse and the SeaweedFS catalog. SeaweedFS is an open-source distributed file and object store with an S3-compatible gateway. Its S3 Table Buckets provide both halves of an Iceberg deployment: the embedded Iceberg REST catalog serves the table metadata, and the table bucket stores the table data as Parquet files behind the same S3 endpoint:
  • Single service - catalog metadata and Parquet data are served by one process, with no separate metadata database
  • REST API compliance with the Iceberg REST catalog specification
  • Server-side maintenance - automatic Parquet compaction and snapshot expiration, with no external maintenance service
This feature is in beta. Enable it with: SET allow_database_iceberg = 1;On versions before 25.8, where the feature is experimental, use SET allow_experimental_database_iceberg = 1; instead.

Local development setup

For local development and testing, you can run SeaweedFS and ClickHouse with Docker Compose. This approach is ideal for learning, prototyping, and development environments.

Prerequisites

  1. Docker and Docker Compose: Ensure Docker is installed and running
  2. Versions: SeaweedFS 4.42 or later; ClickHouse 26.8 or later (versions back to 25.8 can read and insert, but creating tables through the catalog requires 26.8)
  3. Python with PyIceberg (optional): used below to seed sample data

Setting up the local SeaweedFS catalog

Step 1: Create a new folder in which to run the example, then create a file s3config.json with the credentials for the S3 gateway and the catalog:
Step 2: Create a file docker-compose.yml with the following configuration:
The mini command starts the whole SeaweedFS stack in a single container. The -tableBucket=analytics flag pre-creates an S3 Tables bucket named analytics, which serves as the Iceberg warehouse. -admin.port=12646 keeps the admin gRPC port that SeaweedFS derives from it below the Linux ephemeral port range, where a startup connection could otherwise claim it first. Step 3: Run the following command to start the services:

Seeding sample data

The catalog starts out empty. Create a table and append a few rows with PyIceberg (pip install pyiceberg pyarrow):

Connecting to the local SeaweedFS catalog

Connect to your ClickHouse container:
Then create the database connection to the SeaweedFS catalog:
The engine arguments carry the S3 credentials ClickHouse uses to read table data, while catalog_credential and oauth_server_uri authenticate to the catalog itself through the OAuth2 client-credentials flow. SeaweedFS accepts the same access key and secret key for both.

Querying SeaweedFS catalog tables using ClickHouse

Now that the connection is in place, you can start querying via the SeaweedFS catalog. For example:
Backticks requiredBackticks are required because ClickHouse doesn’t support more than one namespace.
To query a table:

Creating tables and writing data from ClickHouse

You can also create tables in the SeaweedFS catalog and write to them directly from ClickHouse:
The IcebergS3 engine clause names the storage path for the new table, and write_full_path_in_iceberg_metadata makes ClickHouse register the full table location with the catalog. On versions before 26.2, the insert setting is named allow_experimental_insert_into_iceberg.
Creating tables through a catalog requires ClickHouse 26.8 or later. Versions 26.4 through 26.7 write the table files before registering the namespace, which SeaweedFS rejects unless the namespace already exists in the catalog; versions before 26.4 appear to succeed, but the table files are written to object storage without being registered in the catalog.
SeaweedFS 4.42 or later adds or corrects metadata when ClickHouse commits an insert, allowing PyIceberg and Spark to read the inserted data. This includes filling in missing field IDs, converting bucket-relative file paths to absolute locations, and adding a default column name mapping.

Loading data from your Data Lake into ClickHouse

If you need to load data from the SeaweedFS catalog into ClickHouse, start by creating a local ClickHouse table:
Then load the data from your SeaweedFS catalog table via an INSERT INTO SELECT: