You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/unify/linked-profiles/setup-guides/snowflake-setup.md
+97-69Lines changed: 97 additions & 69 deletions
Original file line number
Diff line number
Diff line change
@@ -10,43 +10,51 @@ beta: true
10
10
11
11
On this page, you'll learn how to connect your Snowflake data warehouse to Segment.
12
12
13
-
Be sure to log in with a user that has read and write permissions so that Segment can write to your database.
13
+
Within Snowflake, log in with a user that has admin priveleges to provide Segment Linked Profiles with the necessary permissions below.
14
14
15
15
> info ""
16
16
> Both Linked Events and Linked Profiles support Snowflake.
17
17
18
18
19
-
## Getting started
19
+
## Required connection settings within Segment
20
20
21
-
Use the following steps to set up Snowflake for Linked Profiles.
21
+
Segment requires the following settings to connect to your Snowflake warehouse.
22
22
23
-
### Set up Snowflake Credentials and create internal Segment DB
23
+

24
24
25
-
Run the SQL below to provide Segment Linked Profiles with the necessary permissions and roles to access the databases, tables, and schemas. These steps involve:
26
-
- Creating a new role and user for Segment Linked Profiles.
27
-
- Granting read-only access to specific databases and schemas that you want to use for Linked Profiles.
28
-
- Granting write access to an internal database that Segment requires for bookkeeping purposes.
29
-
-[Optional] Creating a new warehouse if it does not exist yet. You can skip this step if a warehouse already exists.
30
-
-[Optional] As a best practice, Segment recommends that restrict access to specific databases and schemas.
31
-
- Running the script below to configure the Warehouse permissions.
25
+
-**Account ID**: The Snowflake account ID that uniquely identifies your organization account.
26
+
-**Database Name**: The only database that Segment requires write access to in order to create tables for internal bookkeeping. This database is referred to as `segment_connection_db` in the script below.
27
+
-**Warehouse**: The warehouse in your Snowflake account that you wish to use for Segment to run the SQL queries. This warehouse is referred to as `segment_connection_warehouse` in the script below.
28
+
-**Username**: The Snowflake user that will be used by Segment to run SQL in your warehouse. This user is referred to as `segment_connection_username` in the script below.
29
+
-**Password**: The password of the user above. This password is referred to as `segment_connection_password` in the script below.
Segment recommends setting up a new Snowflake user and only giving this user permissions to access the required databases and schemas for Segment Linked Profiles.
34
+
35
+
Segment only requires write access to one database where it creates a schema for internal bookkeeping. Segment recommends creating an empty database for this purpose using the script below. All other databases and schemas require read-only access granted to the Segment user.
40
36
41
-
--UsethesameDBthathasProfilesSyncconfigured. ThisDBisalsousedforSegment's internal bookkeeping. Note: Use this DB in the connection settings on the Segment app.
Use the following steps to set up your Snowflake credentials:
46
39
40
+
- Create a new role and user for Segment Linked Profiles.
41
+
- Grant the Segment user access to the warehouse of your choice. If you'd like to create a new warehouse, uncomment the SQL below.
42
+
- Create a new database that Segment will use for internal bookkeeping. You'll need to grant the Segment user **write** access to this database that is used to store checkpoint tables for the queries that are executed. This is the database you'll be required to specify for the "Database Name" when connecting Snowflake with the Segment app.
--TheDBusedforSegment's internal bookkeeping. Note: Use this DB in the connection settings on the Segment app. This is the only DB that Segment requires write access to.
Next, give the Segment user **read-only** access to all the other databases you want to use for Linked Profiles.
104
95
105
-
(Optional) [Snowflake Schema Access](https://docs.snowflake.com/en/user-guide/security-access-control-privileges#table-privileges): If you want to restrict access to specific schemas or tables, then run the following command:
96
+
Run the SQL query below for **each** database you want to use for Linked Profiles:
[Snowflake schema access](https://docs.snowflake.com/en/user-guide/security-access-control-privileges#table-privileges): If you want to restrict access to specific schemas or tables, then run the following commands:
Run the following SQL if you run into an error on the Segment app indicating that the user doesn't have sufficient priveleges on an existing `_segment_reverse_etl` schema.
143
+
144
+
If Segment Reverse ETL has ever run in the database you are configuring as the Segment connection database, a Segment-managed schema is already created and you need to provide the new Segment user access to the existing schema.
145
+
146
+
> warning ""
147
+
> This is only applicable if you choose to use an existing database as the Segment connection database that has also been used for Segment Reverse ETL.
123
148
124
-
If Reverse ETL has ever run in the database you are configuring as the Segment Internal DB, a Segment-managed schema is created and a new user is added. Add the Snowflake table permissions by running the following command.
149
+
150
+
Add the Snowflake table permissions by running the following commands:
To verify you have set up the right permissions for a specific table, log in with the username and password you created for `SEGMENT_LINKED_USER` and run the following command to verify the role you created has the correct permissions. This command should succeed and you should be able to view the respective table.
167
+
To verify you have set up the right permissions for a specific table, log in with the username and password you created for `SEGMENT_CONNECTION_USERNAME` and run the following command to verify the role you created has the correct permissions. This command should succeed and you should be able to view the respective table.
0 commit comments