Accessing Iceberg Tables in Snowflake Open Catalog via External Catalog

Overview

Lakehouse supports connecting to third-party Iceberg REST APIs through the Catalog Integration feature, enabling seamless integration with external data catalogs. This document describes how to connect to and use Snowflake's Open Catalog feature.

Features:

  • Unified data access: Access Iceberg tables in Snowflake Open Catalog through a unified interface
  • Real-time data synchronization: Directly read the latest data in Snowflake without data replication
  • Metadata mapping: Automatically map table structures and metadata from Snowflake
  • OAuth authentication: Support for secure OAuth 2.0 authentication mechanism

Environment Preparation

Snowflake Open Catalog provides two types of catalogs:

Internal Catalog:

  • Features: Lakehouse supports full read and write operations
  • Data management: Supports full lifecycle operations including table structure changes, data inserts, updates, and deletes

External Catalog:

  • Features: Lakehouse only supports read-only operations
  • Data access: Supports complex queries and cross-table analysis, but does not support data modification operations

Prepare Iceberg tables in Snowflake and register them in Snowflake Open Catalog. Please refer to the Snowflake official documentation

Result: A table in the Snowflake engine is registered in Snowflake Open Catalog:

  • Database name: ICEBERG_TABLES_DB_FLATTEN
  • Schema name: ICEBERG_SCHEMA
  • Iceberg table name: czcustomer (lowercase required. In Snowflake's CREATE TABLE DDL, use double quotes to prevent the table name from being automatically converted to uppercase)

Configuration Steps

Step 1: Create a Catalog Connection

Use the following SQL statement to create a connection to Snowflake Open Catalog:

CREATE CATALOG CONNECTION snow_opencatalog
    TYPE ICEBERG_REST
    URI='https://lhnrdre-derekmeng.snowflakecomputing.com/polaris/api/catalog'
    ACCESS_REGION = 'ap-southeast-1'
    OAUTH_CLIENT_ID='d3r3cuhHitrI+fUpFtvXxxxxxxx'
    OAUTH_CLIENT_SECRET='gY3ZWOGoSMM1tKK7QaqQYKpSdTcPY1ruVv7xxxxxxx'
    OAUTH_SCOPE='PRINCIPAL_ROLE:ALL'
    NAMESPACE='ICEBERG_TABLES_DB_FLATTEN_ICEBERG_SCHEMA'
    WAREHOUSE='singdata'
    WITH PROPERTIES (
        'client.region'='ap-southeast-1',
        'io-impl'='org.apache.iceberg.aws.s3.S3FileIO'
    );
ParameterDescriptionExample
TYPEConnection type, fixed as ICEBERG_RESTICEBERG_REST
URISnowflake Polaris API endpointhttps://account.snowflakecomputing.com/polaris/api/catalog
ACCESS_REGIONRegion where the accessed object is locatedap-southeast-1
OAUTH_CLIENT_IDOAuth client IDObtained when creating a Service connection in Snowflake Open Catalog
OAUTH_CLIENT_SECRETOAuth client secretObtained when creating a Service connection in Snowflake Open Catalog
OAUTH_SCOPEOAuth authorization scopePRINCIPAL_ROLE:ALL
NAMESPACEThe second level in Snowflake Open CatalogICEBERG_TABLES_DB_FLATTEN_ICEBERG_SCHEMA
WAREHOUSESnowflake Open Catalog's Catalog namesingdata

Step 2: Create an External Table

Create an external table to map tables in Snowflake Open Catalog:

-- Create external table mapping to the table in Snowflake Open Catalog (table name must match)
CREATE EXTERNAL TABLE IF NOT EXISTS `czcustomer`
USING ICEBERG
CONNECTION snow_opencatalog;

Step 3: Verify and Query

Verify the table structure and query data:

-- View table structure
DESC EXTENDED `czcustomer`;

-- Query data
SELECT * FROM `czcustomer` LIMIT 10;

Usage Limitations

  • When connecting to S3-based Snowflake-managed Iceberg tables, write and update operations are not supported
  • External table names must exactly match the source table names in Snowflake
  • Currently only lowercase table names are supported
  • Table name conversion is not supported
  • Credential Vending must be enabled on the target Catalog service side