Skip to main content
This page sets up a Snowflake connection that signs in as a dedicated service user with key-pair authentication. Datafold reads the databases you grant it and writes scratch tables to a schema you create for it.

Before you begin

  • A Snowflake admin role that can create users and roles and grant privileges, such as SECURITYADMIN or ACCOUNTADMIN.
  • The name of the warehouse Datafold should use and the databases in scope.
  • Permission to add data connections in Datafold.
Snowflake is retiring password sign-ins for non-human users. New service users must be created with TYPE = SERVICE, which cannot have a password. Snowflake also blocks password authentication for existing service users. The steps below create a SERVICE user with key-pair authentication. If you already have a Datafold connection that uses a password, see Snowflake key-pair authentication.
The examples use 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.
  1. In Datafold, go to Settings → Integrations → Data Connections, click Add new integration and choose Snowflake.
  2. Under Authentication method, select Key pair.
  3. Next to Key pair file, click Generate, then Download. The downloaded datafold.pub is the public key.
  4. Leave the form open. You complete it after running the SQL below.
Snowflake expects the key without the -----BEGIN PUBLIC KEY----- and -----END PUBLIC KEY----- lines and without line breaks:
Use the output as <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

Do not add 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:
If any future grants are defined at the schema level, the database-level future grants above do not apply to that schema, because schema-level future grants take precedence. In that case, also run these grants for each schema Datafold uses:
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.

Full script