Lakekeeper catalog

```
SET allow_experimental_database_iceberg = 1;

CREATE DATABASE demo
ENGINE = DataLakeCatalog('http://lakekeeper:8181/catalog', 'minio', 'ClickHouse_Minio_P@ssw0rd')
SETTINGS catalog_type = 'rest', storage_endpoint = 'http://minio:9002/warehouse-rest', warehouse = 'demo'
```

## Querying Lakekeeper catalog tables using ClickHouse[​](#querying-lakekeeper-catalog-tables-using-clickhouse "Direct link to Querying Lakekeeper catalog tables using ClickHouse")

Now that the connection is in place, you can start querying via the Lakekeeper catalog. For example:

```
USE demo;

SHOW TABLES;
```

If your setup includes sample data (such as the taxi dataset), you should see tables like:

```
┌─name──────────┐
│ default.taxis │
└───────────────┘
```

Note

If you don't see any tables, this usually means:

1. The environment hasn't created the sample tables yet
2. The Lakekeeper catalog service isn't fully initialized
3. The sample data loading process hasn't completed

You can check the Spark logs to see the table creation progress:

```
docker-compose logs spark
```

To query a table (if available):

```
SELECT count(*) FROM `default.taxis`;
```

```
┌─count()─┐
│ 2171187 │
└─────────┘
```

Backticks required

Backticks are required because ClickHouse doesn't support more than one namespace.

To inspect the table DDL:

```
SHOW CREATE TABLE `default.taxis`;
```

```
┌─statement─────────────────────────────────────────────────────────────────────────────────────┐
│ CREATE TABLE demo.`default.taxis`                                                             │
│ (                                                                                             │
│     `VendorID` Nullable(Int64),                                                               │
│     `tpep_pickup_datetime` Nullable(DateTime64(6)),                                           │
│     `tpep_dropoff_datetime` Nullable(DateTime64(6)),                                          │
│     `passenger_count` Nullable(Float64),                                                      │
│     `trip_distance` Nullable(Float64),                                                        │
│     `RatecodeID` Nullable(Float64),                                                           │
│     `store_and_fwd_flag` Nullable(String),                                                    │
│     `PULocationID` Nullable(Int64),                                                           │
│     `DOLocationID` Nullable(Int64),                                                           │
│     `payment_type` Nullable(Int64),                                                           │
│     `fare_amount` Nullable(Float64),                                                          │
│     `extra` Nullable(Float64),                                                                │
│     `mta_tax` Nullable(Float64),                                                              │
│     `tip_amount` Nullable(Float64),                                                           │
│     `tolls_amount` Nullable(Float64),                                                         │
│     `improvement_surcharge` Nullable(Float64),                                                │
│     `total_amount` Nullable(Float64),                                                         │
│     `congestion_surcharge` Nullable(Float64),                                                 │
│     `airport_fee` Nullable(Float64)                                                           │
│ )                                                                                             │
│ ENGINE = Iceberg('http://minio:9002/warehouse-rest/warehouse/default/taxis/', 'minio', '[HIDDEN]') │
└───────────────────────────────────────────────────────────────────────────────────────────────┘
```

## Loading data from your Data Lake into ClickHouse[​](#loading-data-from-your-data-lake-into-clickhouse "Direct link to Loading data from your Data Lake into ClickHouse")

If you need to load data from the Lakekeeper catalog into ClickHouse, start by creating a local ClickHouse table:

```
CREATE TABLE taxis
(
    `VendorID` Int64,
    `tpep_pickup_datetime` DateTime64(6),
    `tpep_dropoff_datetime` DateTime64(6),
    `passenger_count` Float64,
    `trip_distance` Float64,
    `RatecodeID` Float64,
    `store_and_fwd_flag` String,
    `PULocationID` Int64,
    `DOLocationID` Int64,
    `payment_type` Int64,
    `fare_amount` Float64,
    `extra` Float64,
    `mta_tax` Float64,
    `tip_amount` Float64,
    `tolls_amount` Float64,
    `improvement_surcharge` Float64,
    `total_amount` Float64,
    `congestion_surcharge` Float64,
    `airport_fee` Float64
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(tpep_pickup_datetime)
ORDER BY (VendorID, tpep_pickup_datetime, PULocationID, DOLocationID);
```

Then load the data from your Lakekeeper catalog table via an `INSERT INTO SELECT`:

```
INSERT INTO taxis 
SELECT * FROM demo.`default.taxis`;
```

- [Local Development Setup](#local-development-setup)
  - [Prerequisites](#local-prerequisites)- [Setting up Local Lakekeeper Catalog](#setting-up-local-lakekeeper-catalog)- [Connecting to Local Lakekeeper Catalog](#connecting-to-local-lakekeeper-catalog)- [Querying Lakekeeper catalog tables using ClickHouse](#querying-lakekeeper-catalog-tables-using-clickhouse)- [Loading data from your Data Lake into ClickHouse](#loading-data-from-your-data-lake-into-clickhouse)

Was this page helpful?