Querying shared data from Snowflake
Snowflake is one of the external engines that can read data shared through the Cloudera Iceberg REST Catalog. Configure a Snowflake catalog integration that points to the Cloudera data sharing endpoint, and follow the Snowflake documentation to run queries.
Any engine that supports the Apache Iceberg REST catalog specification can read the Iceberg tables that you share through the Cloudera Iceberg REST Catalog. Snowflake is one such engine. Cloudera provides and supports the data sharing endpoint; the configuration and operation of Snowflake is described in the Snowflake documentation.
What you configure in Cloudera
Before an external engine can query shared data, complete the data sharing setup on the Cloudera side:
- Register the external client and create a Data Share, then provision the
CLIENT_IDandCLIENT_SECRETthat the engine uses to authenticate. For more information, see Setting up Cloudera Iceberg REST Catalog for data sharing. - Allow the addresses that Snowflake uses to reach the Knox gateway. Snowflake validates the catalog integration when you create it and polls the endpoint for automatic refresh, so the security group must persistently allow this access. Snowflake egresses from non-fixed addresses, so allow its published egress ranges or use private connectivity.
- Expose the Cloudera Iceberg REST Catalog path of Knox through a public endpoint that Snowflake can reach on port 443, with a TLS certificate from a publicly trusted certificate authority. Do not expose other Knox paths. This endpoint is separate from the S3-compatible endpoint that Snowflake uses to read the data files. The two endpoints do not need to use the same domain name, but they can.
- Use the data sharing token and REST catalog endpoints when you configure the engine. For the endpoint paths and the authentication flow, see Supported REST Catalog APIs for accessing the data.
What you configure in Snowflake
In Snowflake, create an Iceberg REST catalog integration that points to the Cloudera data sharing endpoint using the credentials and endpoint values from the previous steps, and then create a catalog-linked database to query the tables. For instructions, see the Snowflake documentation:
Additional requirements for Ozone storage
When the shared tables are stored on Cloudera Object Store (powered by Apache Ozone), Snowflake reads the table data through an S3-compatible external volume that uses a long-lived access key, not through catalog-vended credentials. Snowflake supports catalog-vended credentials only for Amazon S3, Azure Storage, and Google Cloud Storage. For more information, see Use catalog-vended credentials for Apache Iceberg tables in the Snowflake documentation.
Before you configure Snowflake, complete the following tasks in Cloudera:
- Configure virtual-hosted-style S3 access and a publicly accessible S3-compatible endpoint. For more information, see Configuring virtual-hosted-style S3 access for external clients.
- Make sure that the endpoint meets the Snowflake requirements and that Snowflake Support has enabled the endpoint for your Snowflake account. For more information, see Requirements for S3-compatible storage in the Snowflake documentation.
- Generate a long-lived Ozone S3 access key and secret for Snowflake. For more information, see Obtaining S3 credentials in Ozone.
- Provide the Snowflake administrator with the public endpoint, the access key and secret, and the bucket and base path of the shared tables.
For the Snowflake configuration, see the following Snowflake documentation:
Cloudera values for the catalog integration
Set the following Snowflake catalog integration parameters to point Snowflake at the Cloudera data sharing endpoint. Replace the placeholders with the values for your environment.
| Parameter | Value to set |
|---|---|
CATALOG_SOURCE |
ICEBERG_REST |
TABLE_FORMAT |
ICEBERG |
CATALOG_NAMESPACE |
The database (namespace) that contains the shared tables, for example the database you shared in the Data Share. |
CATALOG_URI |
Use the base REST catalog URI without a trailing |
CATALOG_API_TYPE |
PUBLIC |
ACCESS_DELEGATION_MODE |
Snowflake reads the data files through the external volume that you configure for the Ozone S3-compatible endpoint. For more information, see Configure an external volume for S3-compatible storage in the Snowflake documentation. |
REST_AUTHENTICATION TYPE |
Use |
REST_AUTHENTICATION
BEARER_TOKEN |
A JWT access token that you obtain from the Cloudera token endpoint.
For the two-step authentication flow that exchanges the
|
Example: Snowflake catalog integration
First, obtain a JWT from the Cloudera token endpoint, from a host whose address the Knox security group allows:
JWT=$(curl -sk -X POST -H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=[***CLIENT-ID***]&client_secret=[***CLIENT-SECRET***]" \
"https://[***DL-GATEWAY-FQDN***]/[***DL-NAME***]/cdp-datashare-access/knoxtoken/api/v2/token" | jq -r .access_token)
Then, create the catalog integration in Snowflake, using the JWT as the bearer token:
CREATE OR REPLACE CATALOG INTEGRATION cdp_iceberg
CATALOG_SOURCE = ICEBERG_REST
TABLE_FORMAT = ICEBERG
CATALOG_NAMESPACE = '[***DB***]'
REST_CONFIG = (
CATALOG_URI = 'https://[***DL-GATEWAY-FQDN***]/[***DL-NAME***]/cdp-datashare-access/iceberg-rest'
CATALOG_NAME = '[***DL-NAME***]'
CATALOG_API_TYPE = PUBLIC
ACCESS_DELEGATION_MODE = VENDED_CREDENTIALS
)
REST_AUTHENTICATION = (
TYPE = BEARER
BEARER_TOKEN = '[***JWT***]'
)
ENABLED = TRUE;
The bearer token expires. To refresh it in place without recreating the integration,
use ALTER CATALOG INTEGRATION with a fresh JWT:
ALTER CATALOG INTEGRATION cdp_iceberg
SET REST_AUTHENTICATION = ( BEARER_TOKEN = '[***FRESH-JWT***]' );
After you create the catalog integration, create a catalog-linked database to sync the tables, and then you can query them:
CREATE DATABASE cdp_linked_db
LINKED_CATALOG = ( CATALOG = 'cdp_iceberg' );
USE DATABASE cdp_linked_db;
SELECT * FROM [***DB***].[***TABLE***] LIMIT 10;
