Snowflake’s Data Cloud is powered by an advanced data platform provided as Software-as-a-Service (SaaS). Configure Snowflake as one of ChartMogul’s advanced destinations to export MRR movements, customers, custom attributes, and tags to Snowflake tables. From there, you can create your own views and combine datasets for further analysis.
Here’s what we cover in this article:
- Creating a Snowflake database and warehouse
- Creating a Snowflake role and grant permissions
- Securing network access to Snowflake
- Creating a Snowflake user
- Creating a storage bucket
- Adding Snowflake as a destination
- Deleting Snowflake as a destination
Resources and further reading:
- Getting Started with Snowflake
- Key Concepts & Architecture
- Understanding MRR Movements
- Custom Attributes
- Tags
- Developer resources: Destinations and Datasets in Destinations
Before you begin
Please review the following details before completing the steps outlined in this article.
- You’ll need to identify your Snowflake account identifier using an account locator in the format
account_locator.cloud_region_id
or account name in the formatorganization-account_name
. - You’ll need to decide which cloud option ChartMogul will use as a storage staging area to ingest your data: AWS S3 or Google Cloud Storage.
- Steps 1–5 require you to execute SQL commands (queries) using a worksheet in Snowflake.
- ChartMogul uses an S3 or GCS bucket (depending on your chosen provider, that you’ll set up) as a staging area to send data to Snowflake. ChartMogul first uploads data using the parquet data storage format to the bucket, then moves the data into Snowflake tables. ChartMogul refreshes (overwrites) the data in these tables as part of its daily sync.
- If you have already configured Amazon S3 or Google Cloud Storage as a destination, we recommend creating a new S3 bucket for your Snowflake destination.
Step 1 — Create a Snowflake database and warehouse
Create a new Snowflake database and warehouse for ChartMogul:
- Log in to Snowflake.
- Within Worksheets, click + Worksheet. Copy and paste the following commands into the SQL editor:
CREATE DATABASE CHARTMOGUL_DATA; CREATE WAREHOUSE CHARTMOGUL_WAREHOUSE WITH WAREHOUSE_SIZE = 'XSMALL' WAREHOUSE_TYPE = 'STANDARD AUTO_SUSPEND = 60 INITIALLY_SUSPENDED = true;
- Select the commands and click the Run button.
Step 2 — Create a Snowflake role and grant permissions
Create a new role with the permissions required to load your data into the newly-created warehouse:
- Copy and paste the following commands into the SQL editor:
CREATE ROLE CHARTMOGUL; GRANT USAGE ON WAREHOUSE CHARTMOGUL_WAREHOUSE TO ROLE CHARTMOGUL; GRANT USAGE ON DATABASE CHARTMOGUL_DATA TO ROLE CHARTMOGUL; GRANT CREATE SCHEMA ON DATABASE CHARTMOGUL_DATA TO ROLE CHARTMOGUL; GRANT ALL ON ALL SCHEMAS IN DATABASE CHARTMOGUL_DATA TO ROLE CHARTMOGUL;
- Select the commands and click the Run button.
Step 3 — Secure network access to Snowflake
We recommend creating a network policy to limit access to your Snowflake instance to ChartMogul IP addresses:
- Copy and paste the following command into the SQL editor:
CREATE NETWORK POLICY CHARTMOGUL_POLICY ALLOWED_IP_LIST=('3.248.174.47/32','99.80.87.208/32','34.248.167.65/32');
- Select the command and click the Run button.
Step 4 — Create a Snowflake user
Create a dedicated Snowflake user for ChartMogul and grant database access:
- Copy and paste the following commands into the SQL editor, replacing <PASSWORD> with the appropriate value:
CREATE USER CHARTMOGUL_USER MUST_CHANGE_PASSWORD = FALSE DEFAULT_ROLE = CHARTMOGUL PASSWORD = "<PASSWORD>" NETWORK_POLICY = “CHARTMOGUL_POLICY”; GRANT ROLE CHARTMOGUL TO USER CHARTMOGUL_USER;
- Select the commands and click the Run button.
Step 5 — Create a storage bucket
ChartMogul provides two options for bucket storage: AWS S3 or Google Cloud Storage.
To use AWS S3:
- Follow steps 1–3 in Configuring Amazon S3 as a destination. Note the Access key ID and Secret access key, as you’ll need these in the final step. Alternatively, click Download.csv to save this information.
- Follow the steps to add Snowflake as a destination and choose AWS S3 when configuring storage.
To use Google Cloud Storage:
- Follow steps 1–4 in Configuring Google Cloud Storage as a destination. Note the location of your account’s private key as a JSON file, as you’ll need this in the final step.
- Follow the steps for Configuring an Integration for Google Cloud Storage. When creating a custom IAM role, the Snowflake Integration only requires the Data loading only permissions.
- Copy and paste the following commands into the SQL editor, replacing <INTEGRATION_NAME> with the name of the integration you created in the previous step:
GRANT USAGE ON INTEGRATION <INTEGRATION_NAME> TO ROLE CHARTMOGUL;
- Follow the steps to add Snowflake as a destination and choose Google Cloud Storage when configuring storage.
Step 6 — Add Snowflake as a destination
- With ChartMogul, navigate to Settings & Data > Destinations.
- Click Add Destination and select Snowflake.
- Enter a unique name for your destination in the Name field. Then click Next.
- Choose how often you’d like ChartMogul to export data to Snowflake, either:
- Daily (09:00 UTC each day),
- Weekly (09:00 UTC each Sunday), or
- Monthly (09:00 UTC on the first day of each month).
- Choose which datasets you'd like ChartMogul to send:
- Within Configure Snowflake:
- Account: Snowflake account identifier.
- Warehouse: The name of the warehouse you created in Step 1.
- Username: The name of the user you created in Step 4.
- Password: The password for the user you set in Step 4.
- Database: The name of the database you created in Step 1.
- Role: The name of the role you created in Step 2.
-
Schema Prefix (Optional): ChartMogul uses
chartmogul_data
as the schema name. Complete this field to add a prefix to the schema.
- Select your storage bucket and complete the following fields:
- For AWS S3:
- Bucket Name: The name of your bucket created in Step 5.
- AWS Region: The region of your bucket selected in Step 5.
- Access Key ID: The Access key ID from Step 5.
- Secret Access Key: The Secret access key from Step 5.
- For Google Cloud Storage:
- GCS Integration Name: The integration name you created in Step 5.
- Bucket Name: The name of your bucket created in Step 5.
- JSON Key file: The private key you downloaded as a JSON file in Step 5.
- For AWS S3:
- Click Save and Test Connection.
ChartMogul will perform send test data and, if successful, activate Snowflake as a destination. ChartMogul will send actual data to Snowflake with the next scheduled export depending on your Update Frequency setting.
After deleting your Snowflake destination in ChartMogul, the data that has been synced up to the point of deletion will remain in the database.