Query Census Store from Snowflake
Integrate Census Store with your Snowflake warehouse using Apache Iceberg for Zero-ETL access to SaaS and CSV datasets
Prerequisites
To query Census Store from Snowflake, you will need:
A Snowflake account
A Census workspace with:
a customer S3 bucket configured as its Census Store storage provider
one or more SaaS or CSV datasets materialized in Census Store
An AWS account, and permission to create IAM roles and policies granting access to the S3 bucket where your Census Store catalog is stored
Step 1: Create AWS IAM Policy
In the AWS account where the S3 bucket containing your Census Store catalog is located, create an IAM Policy that Snowflake will use to access your Census Store data:
Open the AWS Console and navigate to IAM.
Select Policies in the navigation and click Create policy.
Select the JSON editor and enter the following policy document.
Substitute the name of the S3 bucket your workspace’s Census Store catalog is stored in for
<bucket name>
.Substitute your workspace’s catalog name, found on the Census Store tab of Workspace settings (under Iceberg Catalog), for
<catalog name>
.
Click Next, name your policy, and click Create policy.
Step 2: Create AWS IAM Role
Next, create the IAM Role that Snowflake will use to access your Census Store data:
Open the AWS Console and navigate to IAM.
Select Roles in the navigation and click Create role.
Under Trusted entity type, select AWS account.
Under An AWS account, select This account.
Click Next, find the policy you created in the previous step, and check the checkbox next to the policy name to attach the policy to the new role.
Click Next, name your role, and click Create role.
Step 3: Create Snowflake External Volume
In Snowflake, create an external volume that allows Snowflake to access your Census Store data:
Open the Snowflake console and create a SQL Worksheet.
Run the following SQL statement in your Snowflake account.
Choose a unique name for this external volume and substitute it for
<external volume name>
.Substitute the name of the S3 bucket your workspace’s Census Store catalog is stored in for
<bucket name>
.Substitute your workspace’s catalog name, found on the Census Store tab of Workspace settings (under Iceberg Catalog), for
<catalog name>
.Substitute the ARN of the role you created in the previous step for
<role arn>
.
Step 4: Establish Trust Relationship between Snowflake and AWS IAM Role
Gather the IAM User ARN and External ID Snowflake assigns to your external volume, and use them to establish a trust relationship between Snowflake and the IAM Role you created in step 2.
Open the Snowflake console and create a SQL Worksheet (or reuse the worksheet from the previous step).
Run the following SQL statement in your Snowflake account. Substitute the name of the external volume you created in the previous step for
<external volume name>
.
The result set contains 3 rows. In the row
STORAGE_LOCATION_1
in theproperty
column, theproperty_value
column will contain a JSON object. Locate the"STORAGE_AWS_IAM_USER_ARN"
and"STORAGE_AWS_EXTERNAL_ID"
keys and note their values. These are the IAM User ARN and External ID for your external volume, respectively.Open the AWS Console and navigate to IAM.
Select Roles in the navigation and find the role you created in step 2. Click the name of the role to open the role details.
Select the Trust relationships tab and click Edit trust policy.
Replace the trust policy with the following trust policy document.
Substitute the IAM User Arn for your external volume for
<iam user arn>
.Substitute the External ID for your external volume for
<external id>
.
Click Update policy.
Step 5: Create Census Store Iceberg REST Catalog Credentials
In Census, create OAuth2 client credentials that Snowflake will use to access the Iceberg catalog for your workspace’s Managed Storage:
Open Census and navigate to Workspace settings.
Select the Census Store tab.
Under Iceberg Catalog, click Create Client Credentials.
Copy the newly-created client ID and secret. The secret is only visible when you first create a set of client credentials. If you lose the secret, you will need to create a new set of client credentials.
Step 6: Create Snowflake Catalog Integration
In Snowflake, create a catalog integration to the Iceberg catalog for your workspace’s Managed Storage:
Open the Snowflake console and create a SQL Worksheet (or reuse the worksheet from earlier steps).
Run the following SQL statement in your Snowflake account.
Choose a unique name for your catalog integration and substitute it for
<catalog integration name>
Substitute your Census workspace’s Iceberg catalog endpoint for
<catalog endpoint>
. You can find your workspace’s Iceberg catalog endpoint on the Census Store tab of Workspace settings under Iceberg Catalog.Substitute your Census workspace’s Iceberg catalog name for
<catalog name>
. You can find your workspace’s Iceberg catalog endpoint on the Census Store tab of Workspace settings under Iceberg Catalog.Substitute the client ID and secret for the Iceberg catalog credentials you created in the previous step for
<client id>
and<client secret>
.
Run the following SQL statement in your Snowflake account to verify connectivity, substituting the name of the catalog integration you just created for
<catalog integration name>
:
Step 7: Create Snowflake Iceberg Tables
Finally, create Snowflake Iceberg tables for the Census Store datasets you want to query from Snowflake. Follow these instructions to add Census Store datasets to Snowflake:
Open the Snowflake console and create a SQL Worksheet (or reuse the worksheet from earlier steps).
Select the database and schema where you want your external tables to be created.
Run the following SQL statement in your Snowflake database.
Choose a unique name for your table in Snowflake. Substitute this name for
<table name>
.Substitute the name of the catalog integration you created in the previous step for
<catalog integration name>
.Substitute the namespace and table name your Census Store dataset is materialized in for
<dataset namespace>
and<dataset table name>
respectively. You can find these names on the dataset details page for your dataset in Census.Substitute the name of the external volume you created in step 3 for
<external volume name>
.
Run a
SELECT
statement against the new table to verify the integration. With auto refresh enabled, Snowflake exposes new data as the data is updated in S3.
Last updated
Was this helpful?