Snowflake connection guide

Prev Next

This guide contains all permissions and requirements for connecting your Snowflake data to Supermetrics.

You can connect to data sources from the Data sources page on the Supermetrics Hub. On the Hub, you can also share an authentication link to connect to a data source you don't have direct access to.

After you connect to the data source on the Hub, you can use the data source connection in all available destinations.

Required permissions

There are two methods to authenticate you Snowflake connection, with OAuth2 or with a key-pair authentication.

Permissions when connecting with OAuth2

To connect with OAuth, you need the following:

  • Snowflake account with the Account admin role

  • OAuth client ID and client secret.

  • Account/Server URL

  • Full table name

  • Warehouse name

Permissions when connecting with a key-pair authentication

To connect with a key-pair authentication, you need the following:

  • Snowflake account with the Account admin role

  • Account/Server URL

  • Full table name

  • Username

  • Private key

  • Passphrase (enter “none” if the key is not encrypted)

  • Warehouse name

Note that these values are case sensitive when connecting to Snowflake connector.

Please also note that the Snowflake table must contain a DATE or DATETIME column to support date range filtering in Supermetrics. You can identify compatible columns by opening the “Columns” tab of your table in Snowflake and sorting by Type.

Step 1: Choose either OAuth2 or Key-pair authentication

For the first step, you will need to choose to authenticate the connection using either OAuth2 or a key-pair authentication. Both methods are outlined below, follow only the instructions for your selected method and continue with step 2.

How to create an OAuth client ID and client secret

  1. Log in to Snowflake and click SYSADMIN.

  2. Click Change, and select the ACCOUNTADMIN role.

  3. Run the following 2 commands in a worksheet:

    1. First command:

      CREATE SECURITY INTEGRATION

      "Supermetrics App"

        TYPE = OAUTH

       ENABLED = TRUE

        OAUTH_CLIENT = CUSTOM

        OAUTH_CLIENT_TYPE = 'CONFIDENTIAL'

        OAUTH_REDIRECT_URI = 'https://supermetrics.com/login-complete'
      ;

    2. Second command:

      SELECT SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('Supermetrics App');

  4. Click row 1 in the output. You'll find this at the bottom of the screen. A popup will open with 3 key-value pairs in JSON format.

  5. Copy the values after the keys OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET. These are your client ID and client secret — keep them safe.

How to create your private key and passphrase

For encrypted keys (with passphrase):

  1. Use OpenSSL to generate an encrypted private key and public key pair

    openssl genrsa 2048 | openssl pkcs8 -topk8 -v2 des3 -inform PEM -out rsa_key.p8
    openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
  2. When prompted, create a passphrase to protect your private key

  3. Have an admin with ACCOUNTADMIN role register you public key in Snowflake using this command:

    ALTER USER username SET RSA_PUBLIC_KEY='MIIBIjANBgkqh...';
  4. To authenticate the connector, use the following value from the private key:

    1. Private key: Copy the entire content of your private key file, including the beginning and end markers: -----BEGIN ENCRYPTED PRIVATE KEY----- to -----END ENCRYPTED PRIVATE KEY-----.

    2. Passphrase: The password you created when generating your private key.

For unencrypted keys (without passphrase):

  1. Use OpenSSL to generate an unencrypted private key and public key pair

    openssl genrsa 2048 | openssl pkcs8 -topk8 -nocrypt -inform PEM -out rsa_key.p8
    openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
  2. Have an admin with ACCOUNTADMIN role register your public key in Snowflake using this command:

    ALTER USER username SET RSA_PUBLIC_KEY='MIIBIjANBgkqh...';
  3. To authenticate the connector, use the following value from the private key:

    1. Private key: Copy the entire content of your private key file, including the begin and end markers: -----BEGIN PRIVATE KEY----- to -----END PRIVATE KEY-----

    2. Passphrase: enter ‘none’ (case sensitive).

Step 2: Find your Account/Server URL

  1. Log in to Snowflake.

  2. In the bottom left, click your username.

  3. Hover over Account in the menu that appears and click View account details.

  4. Copy the value for Account/Server URL.

Step 3: Find your full table name

  1. Log in to Snowflake.

  2. In the left side navigation, click CatalogDatabase explorer.

  3. Select the database and schema where your table is located.

  4. Select the table you want to fetch data from.

  5. Once you are at the selected table the database name, schema, and table name are displayed at the top, separated by slashes in this format: DATABASE_NAME / SCHEMA_NAME / TABLE_NAME

  6. Copy these names and enter them in the following format when connecting in Supermetrics: DATABASE_NAME.SCHEMA_NAME.TABLE_NAME

Step 4: Find your warehouse name

  1. Log in to Snowflake.

  2. In the left side navigation, click CatalogDatabase explorer.

  3. Select the database and schema where your table is located.

  4. Select the table you want to fetch data from.

  5. Open the Data preview tab.

  6. The warehouse name is visible next to the number of rows. Copy the warehouse name.

Query types

If prompted, you need to select a query type to pull data.

  • Table: Fetch data from your table in Snowflake.

Connection instructions

When connecting to Snowflakeusing OAuth2

  1. Select the Snowflake data source on the Supermetrics Hub or in the data destination.

  2. If prompted, choose to make this connection shared or private.

  3. Click Start.

  4. Complete the OAuth login flow.

  5. Create a query by selecting the desired metrics and dimensions.

  6. Set a Date column under the options tab. Note that the Date column is case-sensitive and required.

When connecting to Snowflake using a key-pair authentication

  1. Select the Snowflake data source on the Supermetrics Hub or in the data destination.

  2. If prompted, choose to make this connection shared or private.

  3. Click Start.

  4. Enter your account URL, table name, username, private key, passphrase, warehouse, and click Start.

  5. Create a query by selecting the desired metrics, and dimensions.

  6. Set a Date column under the options tab. Do note that the Date column is case-sensitive and required.

You can also connect to Snowflake from these destinations:

More resources