> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enterprise.emailmeter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Snowflake

> Push your email statistics data directly to your Snowflake instance

<img style={{ borderRadius: '0.5rem' }} src="https://storage.googleapis.com/em-docs/enterprise-documentation/images/snowflake--cover.webp" />

The [Snowflake](https://www.snowflake.com/) integration allows Email Meter to push enriched email analytics data directly to your own Snowflake instance. This enables you to combine your email statistics with other business data in your data warehouse.

The Snowflake integration transfers data to a database that you own and control. This gives you full ownership of the data and the flexibility to transform, combine, and query it alongside your other datasets.

Email Meter handles the data synchronization process, ensuring your Snowflake instance receives regular updates with the latest email metrics and analytics.

## Requirements

Before you can set up the Snowflake integration, please make sure that you meet the requirements below:

* A Snowflake account with administrative access
* A dedicated database for Email Meter data
* A Snowflake user with permissions to create schemas in the target database
* A Snowflake warehouse for data loading operations

## Instructions

To set up the integration, you'll need to create a dedicated user and configure the appropriate permissions in your Snowflake account. Follow these steps:

<Steps>
  <Step title="Create a database">
    Log in to your Snowflake account and create a dedicated database for Email Meter data:

    ```sql theme={null}
    CREATE DATABASE IF NOT EXISTS EMAILMETER;
    ```

    You can customize the database name according to your naming conventions.
  </Step>

  <Step title="Create a warehouse">
    Create a warehouse that will be used for data loading operations:

    ```sql theme={null}
    CREATE WAREHOUSE IF NOT EXISTS EMAILMETER_WH
      WAREHOUSE_SIZE = 'XSMALL'
      AUTO_SUSPEND = 60
      AUTO_RESUME = TRUE;
    ```

    The warehouse size can be adjusted based on your data volume. An X-Small warehouse is typically sufficient for most use cases.
  </Step>

  <Step title="Create a dedicated user and role">
    Create a dedicated role and user for the Email Meter integration:

    ```sql theme={null}
    CREATE ROLE IF NOT EXISTS EMAILMETER_ROLE;
    CREATE USER IF NOT EXISTS EMAILMETER_USER
      DEFAULT_ROLE = EMAILMETER_ROLE
      DEFAULT_WAREHOUSE = EMAILMETER_WH;
    ```
  </Step>

  <Step title="Generate a key pair">
    Generate a private and public key pair for authentication. Run these commands in your terminal:

    ```bash theme={null}
    # Generate encrypted private key
    openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -v2 aes-256-cbc -out snowflake_emailmeter_key.p8

    # Generate public key
    openssl rsa -in snowflake_emailmeter_key.p8 -pubout -out snowflake_emailmeter_key.pub
    ```

    You will be prompted to create a passphrase for the private key. Make sure to save this passphrase securely.
  </Step>

  <Step title="Assign the public key to the user">
    Extract the public key value (without the header/footer lines) and assign it to the user:

    ```sql theme={null}
    ALTER USER EMAILMETER_USER SET RSA_PUBLIC_KEY='MIIBIjANBgkqh...your_public_key_here...';
    ```

    <Info>The public key value is the content of the `.pub` file without the `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----` lines.</Info>
  </Step>

  <Step title="Grant permissions">
    Grant the necessary permissions to the role:

    ```sql theme={null}
    GRANT USAGE ON WAREHOUSE EMAILMETER_WH TO ROLE EMAILMETER_ROLE;
    GRANT USAGE ON DATABASE EMAILMETER TO ROLE EMAILMETER_ROLE;
    GRANT CREATE SCHEMA ON DATABASE EMAILMETER TO ROLE EMAILMETER_ROLE;
    GRANT ROLE EMAILMETER_ROLE TO USER EMAILMETER_USER;
    ```
  </Step>

  <Step title="Share credentials with Email Meter">
    Once the previous steps are completed, please share the following information with your Project Manager or Business Intelligence Consultant:

    * **Host**: Your Snowflake host URL (e.g., `xy12345.us-east-1.aws.snowflakecomputing.com`)
    * **Role**: The role name (e.g., `EMAILMETER_ROLE`)
    * **Warehouse**: The warehouse name (e.g., `EMAILMETER_WH`)
    * **Database**: The database name (e.g., `EMAILMETER`)
    * **Username**: The user name (e.g., `EMAILMETER_USER`)
    * **Private key**: The private key file (`snowflake_emailmeter_key.p8`)
    * **Private key passphrase**: The passphrase used to encrypt the private key
  </Step>
</Steps>

<Info>You can find your Snowflake host URL in your browser's address bar when logged into Snowflake. It follows the format `account-identifier.region.cloud.snowflakecomputing.com` (e.g., `xy12345.us-east-1.aws.snowflakecomputing.com`).</Info>

## Integrate Snowflake with other tools

Once your email analytics data is in Snowflake, you can easily connect it to your favorite Business Intelligence tools. Here are some popular integrations:

* [Tableau](https://help.tableau.com/current/pro/desktop/en-us/examples_snowflake.htm)
* [Power BI](https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-connect-snowflake)
* [Looker](https://cloud.google.com/looker/docs/db-config-snowflake)
* [Metabase](https://www.metabase.com/docs/latest/databases/connections/snowflake)
* [Sigma](https://help.sigmacomputing.com/docs/connect-to-snowflake)

## Frequently asked questions

<AccordionGroup>
  <Accordion title="How often is the data synchronized?">
    Data synchronization frequency depends on your specific requirements. We typically offer daily synchronization, but more frequent updates can be configured based on your needs. Please discuss your requirements with your Business Intelligence Consultant.
  </Accordion>

  <Accordion title="What Snowflake regions are supported?">
    We support all Snowflake cloud regions across AWS, Azure, and Google Cloud. Your data will be transferred to whichever region hosts your Snowflake account.
  </Accordion>

  <Accordion title="Can I use an existing database instead of creating a new one?">
    Yes, you can use an existing database. Just make sure the dedicated role has the appropriate permissions to create schemas in the target database.
  </Accordion>

  <Accordion title="Where can I find the data schema?">
    As our email analytics product is customized to your needs, each client's schema might be a bit different. Please get in touch with your Business Intelligence Consultant to request your own schema documentation.
  </Accordion>

  <Accordion title="Why do you use key pair authentication?">
    Key pair authentication provides enhanced security compared to username/password authentication. It uses RSA key pairs, which are more resistant to brute-force attacks and don't require storing passwords. This is the industry-recommended approach for production environments and automated integrations.
  </Accordion>
</AccordionGroup>
