Skip to content

Commit 272d76f

Browse files
committed
revamp Snowflake dest docs ahead of new content
1 parent b9d2932 commit 272d76f

File tree

1 file changed

+67
-53
lines changed
  • src/connections/storage/catalog/snowflake

1 file changed

+67
-53
lines changed

src/connections/storage/catalog/snowflake/index.md

Lines changed: 67 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,36 @@ redirect_from:
77

88
{% include content/warehouse-ip.html %}
99

10-
[Snowflake](https://docs.snowflake.net/manuals/index.html) is a data warehouse built for the cloud. Snowflake delivers performance, simplicity, concurrency and affordability.
10+
[Snowflake](https://docs.snowflake.net/manuals/index.html){:target="_blank"} is a data warehouse, built for the cloud, that delivers performance, simplicity, concurrency and affordability.
1111

12-
## Getting Started
12+
## Getting started
1313

14-
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.
14+
There are six steps to get started using Snowflake with Segment.
1515

16-
1. Create Virtual Warehouse
17-
2. Create Database
18-
3. Create Role for Segment
19-
4. Create User for Segment
20-
5. Test the User and Credentials
21-
6. Connect Snowflake to Segment
16+
1. [Create a virtual warehouse](#step-1-create-a-virtual-warehouse)
17+
2. [Create a database](#step-2-create-database)
18+
3. [Create a role for Segment](#step-3-create-role-for-segment)
19+
4. [Create a user for Segment](#step-4-create-user-for-segment)
20+
5. [Test the user and credentials](#step-5-test-the-user-and-credentials)
21+
6. [Connect Snowflake to Segment](#step-6-connect-snowflake-to-segment)
2222

23-
### Create Virtual Warehouse
23+
### Prerequisites
2424

25-
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.
25+
To set up the Snowflake destination in Segment, you must have, at a minimum, the following [Snowflake privileges](https://docs.snowflake.com/en/user-guide/security-access-control-overview#label-access-control-overview-privileges){:target="_blank"}:
26+
- [CREATE WAREHOUSE](https://docs.snowflake.com/en/sql-reference/sql/create-warehouse#access-control-requirements){:target="_blank"}: Used to create a Segment-specific virtual warehouses
27+
- [CREATE DATABASE](https://docs.snowflake.com/en/sql-reference/sql/create-database#access-control-requirements){:target="_blank"}: Used to create a Segment-specific database
28+
- [CREATE ROLE](https://docs.snowflake.com/en/sql-reference/sql/create-role#access-control-requirements){:target="_blank"}: Used to create the role that the Segment user assumes in your Snowflake instance
29+
- [CREATE USER](https://docs.snowflake.com/en/sql-reference/sql/create-user#access-control-requirements){:target="_blank"}: Used to create the Segment user in your Snowflake instance
30+
31+
To set up the Snowflake storage destination in Segment, you must have either a [role in the Segment app](/docs/segment-app/iam/roles/) of _Workspace Owner_ or, for Business Tier users, _Warehouse Destination Admin_.
32+
33+
### Step 1: Create a virtual warehouse
34+
35+
Segment's Snowflake destination requires you to first create a Snowflake [virtual warehouse](https://docs.snowflake.com/en/user-guide/warehouses){:target="_blank"}.
36+
37+
To avoid conflicts with other 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 Segment customers when they first create their Snowflake destination.
38+
39+
To create a new virtual warehouse, navigate to **Warehouses** > **Create** in Snowflake's Classic Console or execute the following SQL command:
2640

2741
```sql
2842
CREATE WAREHOUSE "SEGMENT_WAREHOUSE"
@@ -32,45 +46,46 @@ CREATE WAREHOUSE "SEGMENT_WAREHOUSE"
3246
AUTO_RESUME = TRUE;
3347
```
3448

35-
Make sure `AUTO_SUSPEND` is set to ~10 minutes in the UI (or 600 if using SQL) and `AUTO_RESUME` is enabled, to avoid extra costs.
49+
> success ""
50+
> Set `AUTO_SUSPEND` to ~10 minutes in the UI (or 600 if using SQL) and enable `AUTO_RESUME` to avoid extra costs, as Snowflake uses [per-second billing](https://docs.snowflake.com/en/user-guide/warehouses-considerations#automating-warehouse-suspension){:target="_blank"}.
51+
52+
### Step 2: Create Database
3653

37-
### Create Database
54+
Segment recommends creating a new database just for Segment information, as the Segment Snowflake destination creates its own schemas and tables and could create name conflicts with your existing data.
3855

39-
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.
56+
To create a new database, execute the following SQL command:
4057

4158
```sql
4259
CREATE DATABASE "SEGMENT_EVENTS";
4360
```
4461

45-
### Create Role for Segment
46-
47-
You need to run these commands rather than creating a role with the "Create Role" dialog in the UI.
62+
### Step 3: Create role for Segment
4863

49-
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.
64+
You need to run these SQL commands rather than creating a role with the "Create Role" dialog in the Classic Console UI.
5065

51-
1. Click on to Worksheets;
66+
This role gives Segment just enough permission to load data into your database. Segment recommends that you don't reuse this role for other operations.
67+
1. Click on **Worksheets**
5268
2. Select SEGMENT_EVENTS under database objects
53-
3. Change role to ACCOUNTADMIN
54-
55-
4. Create a new role using the following command:
69+
3. Change role to `ACCOUNTADMIN`
70+
4. Create a new role by executing the following command:
5671
```sql
5772
CREATE ROLE "SEGMENT";
5873
```
5974

60-
5. Grant access to the virtual warehouse:
75+
5. Grant access to the virtual warehouse by executing the following SQL command:
6176
```sql
6277
GRANT USAGE ON WAREHOUSE "SEGMENT_WAREHOUSE" TO ROLE "SEGMENT";
6378
```
6479

65-
6. Grant access to the database:
80+
6. Grant access to the database by executing the following SQL command:
6681
```sql
6782
GRANT USAGE ON DATABASE "SEGMENT_EVENTS" TO ROLE "SEGMENT";
6883
GRANT CREATE SCHEMA ON DATABASE "SEGMENT_EVENTS" TO ROLE "SEGMENT";
6984
```
7085

71-
### Create User for Segment
86+
### Step 4: Create user for Segment
7287

73-
Finally, you need to create the user that will be connected to Segment. Be sure to use a strong, unique password.
88+
You need to create the user that Segment uses to connect to your warehouse. Be sure to use a strong, unique password.
7489

7590
```sql
7691
CREATE USER "SEGMENT_USER"
@@ -80,28 +95,28 @@ CREATE USER "SEGMENT_USER"
8095
GRANT ROLE "SEGMENT" TO USER "SEGMENT_USER";
8196
```
8297

83-
### Test the User and Credentials
98+
### Step 5: Test the user and credentials
8499

85100
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.
86101

87-
Segment uses [snowsql](https://docs.snowflake.net/manuals/user-guide/snowsql.html){:target="_blank"} to run these verification steps.
88-
To install and verify your accounts:
102+
Segment uses [SnowSQL](https://docs.snowflake.com/en/user-guide/snowsql){:target="_blank"} to run these verification steps.
103+
To install SnowSQL and verify your accounts:
89104

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

94109
```
95110
snowsql -a <account> -u <user>
96111
```
97112

98113
For accounts outside the US, the account ID includes the region. You can find your account name from the browser address string.
99114

100-
If your web address is `https://myaccountname.snowflakecomputing.com/console#/internal/worksheet`, your account name would be `myaccountname`.
115+
For example, if your web address is `https://myaccountname.snowflakecomputing.com/console#/internal/worksheet`, your account name would be `myaccountname`.
101116

102117
You can also find part of your account name by running the following query on your worksheet in Snowflake:
103118

104-
```
119+
```sql
105120
SELECT CURRENT_ACCOUNT();
106121
```
107122
4. Enter password when prompted.
@@ -145,55 +160,54 @@ USE WAREHOUSE "SEGMENT_WAREHOUSE";
145160
USE DATABASE "SEGMENT_EVENTS";
146161
```
147162

148-
### Connect Snowflake to Segment
163+
### Step 6: Connect Snowflake to Segment
149164

150-
After creating a Snowflake warehouse, the next step is to connect Segment.
165+
After configuring your Snowflake resources, connect them to Segment.
151166

152167
1. In the Segment App, select Add Destination.
153168
2. Search for and select "Snowflake".
154169
3. Add your credentials as follows:
155-
- User - The user name (as created above).
156-
- Password - The password for the user.
157-
- 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`)
158-
- Database - The database name (as created above).
159-
- Warehouse - The warehouse name (as created above).
170+
- **User**: The user name that you created in [Step 4: Create user for Segment](#step-4-create-user-for-segment)
171+
- **Password**: The password that you set in [Step 4: Create user for Segment](#step-4-create-user-for-segment)
172+
- **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 be: `my-business.us-east-1.snowflakecomputing.com/` and your account-id would be: `my-business.us-east-1`)
173+
- **Database**: The database name that you created in [Step 2: Create database](#step-2-create-database)
174+
- **Warehouse**: The name of the warehouse that you created in [Step 1: Create a virtual warehouse](#step-1-create-a-virtual-warehouse)
160175

161176
## Security
162177

163178
### Allowlisting IPs
164179

165-
If you create a network policy with Snowflake, add the following IP addresses to the "Allowed IP Addresses" list: `52.25.130.38/32`, `34.223.203.0/28`
180+
If you create a network policy with Snowflake and are located in the US, add `52.25.130.38/32` and `34.223.203.0/28` to the "Allowed IP Addresses" list.
181+
182+
If you create a network policy with Snowflake and are located in the EU, add `3.251.148.96/29` to your "Allowed IP Addresses" list.
166183

167184
### Multi-Factor Authentication (MFA) & SSO
168185

169186
At this time, the Segment Snowflake destination is not compatible with Snowflake's MFA or SSO settings. If your connected user has MFA or SSO enabled, you will need to disable it for syncs to run correctly.
170187

171188
## Best Practices
172189

173-
### Auto Suspend
174-
175-
Set `AUTO_SUSPEND` to ~10 minutes in the UI (or 600 if using SQL) to avoid credit consumption by the Segment syncing process.
176-
190+
### Auto Suspend and Auto Resume
177191

178-
### Auto Resume
192+
Set `AUTO_SUSPEND` to ~10 minutes in the UI (or 600 if using SQL) to avoid Segment's syncing process credit consumption.
179193

180194
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"}.
181195

182196
### Unique Warehouse, Database, and Role
183197

184-
Segment recommends creating a unique Warehouse, Database and Role for the Segment Snowflake connection to your Snowflake instance.
198+
Segment recommends creating a unique Warehouse, Database and Role for the Segment Snowflake connection to your Snowflake instance to avoid conflicts with other operations happening in your cluster.
185199

186200
## Troubleshooting
187201

188202
### I get "Object does not exist" when running "USE DATABASE" or "USE WAREHOUSE", even if the warehouse or the database are created.
189203

190-
Make sure you have created the role and assigned the proper permissions with the account `SYSADMIN` or `ACCOUNTADMIN`. Other non-system accounts don't assign the right permissions.
204+
Make sure you created the role and assigned the proper permissions with the account `SYSADMIN` or `ACCOUNTADMIN`. Other non-system accounts don't assign the right permissions.
191205

192-
### I've consumed all the credits after the initial sync.
206+
### I've consumed all my credits after the initial sync.
193207

194-
If you have used all your credits, you will need to contact Snowflake to purchase more.
208+
If you have used all your credits, you must contact Snowflake to purchase more.
195209

196-
Also make sure `AUTO_SUSPEND` is enabled and set to 5 or 10 minutes in the warehouse used by Segment. This setting will help avoid unintended use of credits by the Segment Snowflake destination.
210+
Also, make sure `AUTO_SUSPEND` is enabled and set to 5 or 10 minutes in the warehouse used by Segment. This setting helps avoid unintended use of credits by the Segment Snowflake destination.
197211

198212
### My syncs are going slower than I expect.
199213

@@ -212,10 +226,10 @@ Most customers have the best luck starting with a X-Small instance.
212226
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.
213227

214228
### Does Segment use transactions for loading data?
215-
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.
229+
Segment doesn't open transactions explicitly because that would lock resources. However, if `autocommit` is enabled, each statement functions as its own transaction, and a silent commit is issued after each.
216230

217231
### What privileges do I need to grant?
218-
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.
232+
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 Databricks.
219233

220234
Run these statements in Snowflake UI or CLI, and check the output to verify the permissions.
221235

0 commit comments

Comments
 (0)