REST Catalog
Integration with the REST Catalog works with Iceberg tables only. This integration supports both AWS S3 and other cloud storage providers.
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 REST Catalog specification.
The REST Catalog is a standardized API specification for Iceberg catalogs, supported by various platforms including:
- Local development environments (using docker-compose setups)
- Managed services like Tabular.io
- Self-hosted REST catalog implementations
As this feature is experimental, you will need to enable it using:
SET allow_experimental_database_iceberg = 1;
Local Development Setup
For local development and testing, you can use a containerized REST catalog setup. This approach is ideal for learning, prototyping, and development environments.
Prerequisites
- Docker and Docker Compose: Ensure Docker is installed and running
- Sample Setup: You can use various docker-compose setups (see Alternative Docker Images below)
Setting up Local REST Catalog
You can use various containerized REST catalog implementations such as Databricks docker-spark-iceberg which provides a complete Spark + Iceberg + REST catalog environment with docker-compose, making it ideal for testing Iceberg integrations.
Step 1: Create a new folder in which to run the example, then create a file docker-compose.yml
with the configuration from Databricks docker-spark-iceberg.
Step 2: Next, create a file docker-compose.override.yml
and place the following ClickHouse container configuration into it:
Step 3: Run the following command to start the services:
Step 4: Wait for all services to be ready. You can check the logs:
The REST catalog setup requires that sample data be loaded into the Iceberg tables first. Make sure the Spark environment has created and populated the tables before attempting to query them through ClickHouse. The availability of tables depends on the specific docker-compose setup and sample data loading scripts.
Connecting to Local REST Catalog
Connect to your ClickHouse container:
Then create the database connection to the REST catalog:
Querying REST catalog tables using ClickHouse
Now that the connection is in place, you can start querying via the REST catalog. For example:
If your setup includes sample data (such as the taxi dataset), you should see tables like:
If you don't see any tables, this usually means:
- The Spark environment hasn't created the sample tables yet
- The REST catalog service isn't fully initialized
- The sample data loading process hasn't completed
You can check the Spark logs to see the table creation progress:
To query a table (if available):
Backticks are required because ClickHouse doesn't support more than one namespace.
To inspect the table DDL:
Loading data from your Data Lake into ClickHouse
If you need to load data from the REST catalog into ClickHouse, start by creating a local ClickHouse table:
Then load the data from your REST catalog table via an INSERT INTO SELECT
: