# Connect Foundry's Iceberg catalog to Snowflake Foundry can integrate with Snowflake through the [Snowflake connector](../../available-connectors/snowflake/index.md). Snowflake can integrate with Foundry-managed Iceberg tables through an [Apache Iceberg REST catalog integration ↗](https://docs.snowflake.com/en/user-guide/tables-iceberg-configure-catalog-integration-rest). If you encounter issues with these instructions, follow the [authentication troubleshooting instructions](../authentication/index.md#troubleshooting-authentication). :::callout{theme="warning" title="Limitations"} Snowflake does not currently support reading tables with [client-side encryption](../iceberg-settings/index.md#configuring-iceberg-encryption-settings). ::: ## 1. Create a catalog integration 1. Enable your Snowflake instance to egress to your Foundry instance and to the Iceberg storage bucket. 2. Configure [network ingress](../external-client-ingress/index.md) to allow your Snowflake instance to connect to Foundry's Iceberg catalog and the storage location. 3. Run the following query in Snowflake to create a [catalog integration ↗](https://docs.snowflake.com/en/user-guide/tables-iceberg#label-tables-iceberg-catalog-integration-def). You need to use the [ACCOUNTADMIN role ↗](https://docs.snowflake.com/en/user-guide/security-access-control-considerations#using-the-accountadmin-role) to run the query. See the [Snowflake documentation ↗](https://docs.snowflake.com/en/sql-reference/sql/create-catalog-integration-rest) for more details. The following example uses [OAuth2 authentication](../authentication/index.md): ```sql CREATE CATALOG INTEGRATION CATALOG_SOURCE = ICEBERG_REST TABLE_FORMAT = ICEBERG ENABLED = TRUE CATALOG_NAMESPACE = '' -- Foundry folder, for example 'FoundryNamespace.MyProject.tables' for /FoundryNamespace/MyProject/tables REST_CONFIG = ( CATALOG_NAME = 'foundry' CATALOG_URI = 'https:///iceberg' CATALOG_API_TYPE = 'public' ACCESS_DELEGATION_MODE = VENDED_CREDENTIALS ) REST_AUTHENTICATION = ( TYPE = OAUTH OAUTH_TOKEN_URI = 'https:///iceberg/v1/oauth/tokens' OAUTH_CLIENT_ID = '' OAUTH_CLIENT_SECRET = '' OAUTH_ALLOWED_SCOPES = ( 'api:iceberg-read', 'api:iceberg-write' ) ); ``` ## 2. Verify the integration 1. Verify that the integration is configured correctly by running the following query. See [Snowflake documentation ↗](https://docs.snowflake.com/en/sql-reference/functions/system_verify_catalog_integration) for more details. ```sql SELECT SYSTEM$VERIFY_CATALOG_INTEGRATION(''); ``` 2. Verify that you can [list namespaces ↗](https://docs.snowflake.com/en/sql-reference/functions/system_list_namespaces_from_catalog) and [list Iceberg tables ↗](https://docs.snowflake.com/en/sql-reference/functions/system_list_iceberg_tables_from_catalog) from the Foundry Iceberg REST catalog. ```sql SELECT SYSTEM$LIST_NAMESPACES_FROM_CATALOG( '', '', -- Foundry folder, for example 'FoundryNamespace.MyProject.tables' for /FoundryNamespace/MyProject/tables 1 ); SELECT SYSTEM$LIST_ICEBERG_TABLES_FROM_CATALOG( '', '', -- Foundry folder, for example 'FoundryNamespace.MyProject.tables' for /FoundryNamespace/MyProject/tables 1 ); ``` ## 3. Register and read a table Create a table that links to a Foundry table and verify that you can read data from it. This only reads data from Foundry, and does not overwrite or delete the table. ```sql CREATE OR REPLACE ICEBERG TABLE .. CATALOG = '' CATALOG_TABLE_NAME = '' -- or '' CATALOG_NAMESPACE = 'foundry' -- or '' for example 'FoundryNamespace.MyProject.tables' for /FoundryNamespace/MyProject/tables AUTO_REFRESH = TRUE; SELECT * FROM ..; ``` ## 4. Optionally write to a table Write data to a Foundry Iceberg table in Snowflake. ```sql INSERT INTO .. VALUES , , ; ``` ## 5. Optionally link the integration to a database 1. Create a new database linked to the catalog integration: ```sql CREATE DATABASE LINKED_CATALOG = ( CATALOG = '' ); ``` 2. Verify the catalog link status. See the [Snowflake documentation ↗](https://docs.snowflake.com/en/sql-reference/functions/system_catalog_link_status) for more details. ```sql SELECT SYSTEM$CATALOG_LINK_STATUS(''); ```