Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 10 additions & 24 deletions src/connections/storage/catalog/snowflake/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ redirect_from:

## Getting Started

There are six steps to get started using Snowflake with Segment. Make sure that you are running the commands in each step while logged in as an `ACCOUNTADMIN`, or an account that has `MANAGE GRANTS`. While we are using predefined user (`SEGMENT_USER`), role (`SEGMENT`), warehouse (`SEGMENT_WAREHOUSE`) and database (`SEGMENT_EVENTS`) names, you can use any names you like.
There are six steps to get started using Snowflake with Segment. Make sure that you are running the commands in each step while logged in as an `ACCOUNTADMIN`, or an account that has `MANAGE GRANTS`. While Segment uses predefined user (`SEGMENT_USER`), role (`SEGMENT`), warehouse (`SEGMENT_WAREHOUSE`) and database (`SEGMENT_EVENTS`) names, you can use any names you like.

1. Create Virtual Warehouse
2. Create Database
Expand All @@ -20,9 +20,7 @@ There are six steps to get started using Snowflake with Segment. Make sure that

### Create Virtual Warehouse

The Segment Snowflake destination requires a Snowflake [virtual warehouse](https://docs.snowflake.net/manuals/user-guide/warehouses.html) to load data in to. To avoid conflicts with other regular operations in your cluster, we recommend creating a new warehouse just for Segment loads, but this is not mandatory. An X-Small warehouse works for most customers when starting.

![](images/create_virtual_warehouse.png)
The Segment Snowflake destination requires a Snowflake [virtual warehouse](https://docs.snowflake.net/manuals/user-guide/warehouses.html){:target="_blank"} to load data in to. To avoid conflicts with other regular operations in your cluster, Segment recommends that you create a new warehouse just for Segment loads, but this is not mandatory. An X-Small warehouse works for most customers when starting.

```sql
CREATE WAREHOUSE "SEGMENT_WAREHOUSE"
Expand All @@ -38,8 +36,6 @@ Make sure `AUTO_SUSPEND` is set to ~10 minutes in the UI (or 600 if using SQL) a

The Segment Snowflake destination creates its own schemas and tables, so it's recommended to create a new database for this purpose to avoid name conflicts with existing data.

![](images/create_database.png)

```sql
CREATE DATABASE "SEGMENT_EVENTS";
```
Expand All @@ -48,7 +44,7 @@ CREATE DATABASE "SEGMENT_EVENTS";

You need to run these commands rather than creating a role with the "Create Role" dialog in the UI.

This role will be attached to Segment's user and it gives just enough permissions for loading data in your database. We recommend not reusing this role for other operations.
This role will be attached to Segment's user and it gives just enough permissions for loading data in your database. Segment recommends that you not reuse this role for other operations.

1. Click on to Worksheets;
2. Select SEGMENT_EVENTS under database objects
Expand All @@ -74,12 +70,6 @@ GRANT CREATE SCHEMA ON DATABASE "SEGMENT_EVENTS" TO ROLE "SEGMENT";

Finally, you need to create the user that will be connected to Segment. Be sure to use a strong, unique password.

![](images/create_user_1.png)

![](images/create_user_2.png)

![](images/create_user_3.png)

```sql
CREATE USER "SEGMENT_USER"
MUST_CHANGE_PASSWORD = FALSE
Expand All @@ -92,12 +82,11 @@ GRANT ROLE "SEGMENT" TO USER "SEGMENT_USER";

Before you continue, test and validate the new user and credentials. When you can run the following commands successfully, you can connect Snowflake to Segment.

We use [snowsql](https://docs.snowflake.net/manuals/user-guide/snowsql.html) to run these verification steps.
Segment uses [snowsql](https://docs.snowflake.net/manuals/user-guide/snowsql.html){:target="_blank"} to run these verification steps.
To install and verify your accounts:

1. Download [snowsql](https://docs.snowflake.net/manuals/user-guide/snowsql.html);

2. Open the Installer and follow instructions;
1. Download [snowsql](https://docs.snowflake.net/manuals/user-guide/snowsql.html){:target="_blank"}
2. Open the Installer and follow instructions
3. Once the installation is complete, run the following command, replacing "account" and "user" with your Snowflake Account and username:

```
Expand Down Expand Up @@ -159,12 +148,10 @@ After creating a Snowflake warehouse, the next step is to connect Segment.
3. Add your credentials as follows:
- User - The user name (as created above).
- Password - The password for the user.
- Account - The account id of your cluster, not the url (e.g. url: `my-business.snowflakecomputing.com`, account-id: `my-business`. **Note:** If you are using Snowflake on AWS, the account id includes the region, for example your url might look like: `my-business.us-east-1.snowflakecomputing.com/` and your accound-id would be: `my-business.us-east-1`)
- Account - The account id of your cluster, not the url (for example, url: `my-business.snowflakecomputing.com`, account-id: `my-business`. **Note:** If you are using Snowflake on AWS, the account id includes the region, for example your url might look like: `my-business.us-east-1.snowflakecomputing.com/` and your accound-id would be: `my-business.us-east-1`)
- Database - The database name (as created above).
- Warehouse - The warehouse name (as created above).

![](images/connect_snowflake.png)

## Security

### Whitelisting IPs
Expand All @@ -181,15 +168,14 @@ At this time, the Segment Snowflake destination is not compatible with Snowflake

Set `AUTO_SUSPEND` to ~10 minutes in the UI (or 600 if using SQL) to avoid credit consumption by the Segment syncing process.

![](images/auto_suspend.png)

### Auto Resume

If you enable the `AUTO_SUSPEND` feature, we recommend that you also enable `AUTO-RESUME`. This will ensure that your Snowflake warehouse automatically resumes when Segment loads data. Otherwise, Segment will not be able to load data unless you [manually resume your Snowflake warehouse](https://docs.snowflake.net/manuals/user-guide/warehouses-considerations.html#automating-warehouse-resumption).
If you enable the `AUTO_SUSPEND` feature, Segment recommends that you also enable `AUTO-RESUME`. This will ensure that your Snowflake warehouse automatically resumes when Segment loads data. Otherwise, Segment will not be able to load data unless you [manually resume your Snowflake warehouse](https://docs.snowflake.net/manuals/user-guide/warehouses-considerations.html#automating-warehouse-resumption){:target="_blank"}.

### Unique Warehouse, Database, and Role

We strongly recommend creating a unique Warehouse, Database and Role for the Segment Snowflake connection to your Snowflake instance.
Segment recommends creating a unique Warehouse, Database and Role for the Segment Snowflake connection to your Snowflake instance.

## Troubleshooting

Expand Down Expand Up @@ -220,7 +206,7 @@ Most customers have the best luck starting with a X-Small instance.
A `rollback` is issued at the end of each session to make sure there's no "in-flight" processes hanging out that could block other processes later.

### Does Segment use transactions for loading data?
We don't open transactions explicitly because that would lock resources. However, if autocommit is enabled, each statement functions as it's own transaction, and a silent commit is issued after each.
Segment doesn't open transactions explicitly because that would lock resources. However, if autocommit is enabled, each statement functions as it's own transaction, and a silent commit is issued after each.

### What privileges do I need to grant?
You shouldn't need to grant any additional privileges. However, you may need to confirm that the USAGE privilege on those schemas is granted to the same role granted to the user connecting to Snowflake through data bricks.
Expand Down