Features and Configurations

### Workarounds for Working with Iceberg and Catalogs[​](#workarounds-iceberg-catalogs "Direct link to Workarounds for Working with Iceberg and Catalogs")

You can read data from Iceberg tables or catalogs from your dbt project if you have already defined them in your ClickHouse cluster with the tools defined above. You can leverage the `source` functionality in dbt to reference these tables in your dbt projects. For example, if you want to access your tables in a REST Catalog, you can:

1. **Create a database pointing to an external catalog:**

```
-- Example with REST Catalog
SET allow_experimental_database_iceberg = 1;

CREATE DATABASE iceberg_catalog
ENGINE = DataLakeCatalog('http://rest:8181/v1', 'admin', 'password')
SETTINGS 
    catalog_type = 'rest', 
    storage_endpoint = 'http://minio:9000/lakehouse', 
    warehouse = 'demo'
```

2. **Define the catalog database and its tables as sources in dbt:** remember that the tables should already be available in ClickHouse

```
version: 2

sources:
  - name: external_catalog
    database: iceberg_catalog
    tables:
      - name: orders
      - name: customers
```

3. **Use the catalog tables in your dbt models:**

```
SELECT 
    o.order_id,
    c.customer_name,
    o.order_date
FROM {{ source('external_catalog', 'orders') }} o
INNER JOIN {{ source('external_catalog', 'customers') }} c
    ON o.customer_id = c.customer_id
```

### Notes on the Workarounds[​](#benefits-workarounds "Direct link to Notes on the Workarounds")

The good things about these workarounds are:

- You'll have immediate access to different external table types and external catalogs without waiting for native dbt catalog integration.
- You'll have a seamless migration path when native catalog support becomes available.

But there are currently some limitations:

- **Manual setup:** Iceberg tables and catalog databases must be created manually in ClickHouse before they can be referenced in dbt.
- **No catalog-level DDL:** dbt can't manage catalog-level operations like creating or dropping Iceberg tables in external catalogs. So you won't be able to create them right now from the dbt connector. Creating tables with the Iceberg() engines may be added in the future.
- **Write operations:** Currently, writing into Iceberg/Data Catalog tables is limited. Check the ClickHouse documentation to understand which options are available.

- [Profile.yml configurations](#profile-yml-configurations)
  - [Schema vs Database](#schema-vs-database)- [SET Statement Warning](#set-statement-warning)- [Setting `quote_columns`](#setting-quote_columns)- [About the ClickHouse Cluster](#about-the-clickhouse-cluster)- [Additional ClickHouse macros](#additional-clickhouse-macros)
    - [Model materialization utility macros](#model-materialization-utility-macros)- [s3Source helper macro](#s3source-helper-macro)- [Cross database macro support](#cross-database-macro-support)- [Catalog Support](#catalog-support)
      - [dbt Catalog Integration Status](#dbt-catalog-integration-status)- [ClickHouse Catalog Support](#clickhouse-catalog-support)- [Workarounds for Working with Iceberg and Catalogs](#workarounds-iceberg-catalogs)- [Notes on the Workarounds](#benefits-workarounds)

Was this page helpful?