Before you begin
- A Snowflake admin role that can create users and roles and grant privileges, such as
SECURITYADMINorACCOUNTADMIN. - The name of the warehouse Datafold should use and the databases in scope.
- Permission to add data connections in Datafold.
DATAFOLD_USER and DATAFOLD_ROLE. You can choose other names. Replace <DATABASE>, <WAREHOUSE> and <PUBLIC_KEY> with your values. A full script is at the bottom of this page.
Set up Snowflake
1
Generate a key pair in Datafold
Datafold generates the key pair and keeps the private key encrypted. You only register the public key in Snowflake.Use the output as
- In Datafold, go to Settings → Integrations → Data Connections, click Add new integration and choose Snowflake.
- Under Authentication method, select Key pair.
- Next to Key pair file, click Generate, then Download. The downloaded
datafold.pubis the public key. - Leave the form open. You complete it after running the SQL below.
-----BEGIN PUBLIC KEY----- and -----END PUBLIC KEY----- lines and without line breaks:<PUBLIC_KEY>. If you close the form before saving, click Generate again and register the new key instead.2
Create a service user and role
PASSWORD or MUST_CHANGE_PASSWORD: Snowflake does not allow them on SERVICE users. Use TYPE = SERVICE, not the deprecated LEGACY_SERVICE.Datafold reads the SNOWFLAKE.ACCOUNT_USAGE views (tables, columns, views, query and access history) to discover your schemas. The connection test checks this access:3
Grant access to your data
Datafold only sees the tables its role can access. Run these grants for each database in scope:
4
Create a temporary schema
Datafold writes scratch tables to this schema so that data processing stays in your warehouse.
5
Check the grants
Run these queries. Each result should include a row that grants the privilege to
DATAFOLD_ROLE. You may see more rows if other roles have access too.Network access
If your Snowflake account only accepts connections from allowlisted IP addresses or is only reachable over a private network, see Securing connections for the options Datafold supports. If your Snowflake account is only reachable over Azure Private Link, see Securing connections: Connect to Snowflake. Snowflake routes large query results through an internal stage rather than the account endpoint, which typically requires a second private endpoint in addition to the account one.Add the connection in Datafold
Return to the form you left open and fill in the remaining fields:
Click Test. When the test succeeds, click Save.
