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
> Linked Profiles (Data Graph, Linked Events, and Linked Audiences) is in private beta, and Segment is actively working on this feature. Some functionality may change before it becomes generally available. [Contact Segment](https://segment.com/help/contact/){:target="_blank"} with any feedback or questions.
8
+
> Linked Profiles (Data Graph, Linked Events, and Linked Audiences) is in private beta, and Segment is actively working on this feature. Some functionality may change before it becomes generally available.
9
9
10
10
11
11
On this page, you'll learn how to connect your Snowflake data warehouse to Segment.
@@ -18,121 +18,134 @@ Be sure to log in with a user that has read and write permissions so that Segmen
18
18
19
19
## Getting started
20
20
21
-
To get started with Snowflake:
22
-
23
-
1. Log in to your Snowflake account.
24
-
2. Navigate to *Worksheets*.
25
-
26
-
Segment recommends you use the `ACCOUNTADMIN` role to execute the commands below.
27
-
28
-
## Create a new warehouse
29
-
30
-
> info ""
31
-
> This step is optional, and you can use an existing Snowflake warehouse if you'd like.
32
-
33
-
Enter and run the code below to create a virtual warehouse. Linked Profiles needs to execute queries on your Snowflake account, which requires a Virtual Warehouse to handle the compute.
34
-
35
-
```sql
36
-
CREATE WAREHOUSE segment_entities
37
-
WITH WAREHOUSE_SIZE ='XSMALL'
38
-
WAREHOUSE_TYPE ='STANDARD'
39
-
AUTO_SUSPEND =600-- 5 minutes
40
-
AUTO_RESUME = TRUE;
41
-
```
42
-
43
-
## Create a new role
44
-
45
-
Enter and run the code below to create specific roles for Linked Profiles. All Snowflake access is specified through roles, which are then assigned to the user you’ll create later.
Enter and run the code below to create the username and password combination that will be used to execute queries. Make sure to enter your password where it says `<my_strong_password>`.
62
-
63
-
```sql
64
-
-- create user
65
-
CREATEUSERsegment_entities_user
66
-
MUST_CHANGE_PASSWORD = FALSE
67
-
DEFAULT_ROLE = segment_entities
68
-
PASSWORD ='my_strong_password'; -- Do not use this password
69
-
70
-
-- role access
71
-
GRANT ROLE segment_entities TO USER segment_entities_user;
72
-
```
73
-
74
-
## Grant read access to tables
21
+
Use the following steps to set up Snowflake for Linked Profiles.
22
+
23
+
### Set up Snowflake Credentials and create internal Segment DB
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.
--UsethesameDBthathasProfilesSyncconfigured. ThisDBisalsousedforSegment's internal bookkeeping. Note: Use this DB in the connection settings on the Segment app.
To use Linked Profiles, you'll need to grant access to `segment_entities_user` for the schemas and tables you'd like to read from to perform enrichments.
77
104
78
-
These tables need to live in the same database as the one used for storing sync deltas. You can give as broad or narrow of access as you require. If you give broad access to multiple schemas, you can sort through the schemas in Segment to select the appropriate tables to create models from.
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:
79
106
80
-
> info ""
81
-
> Segment only supports tables, materialized views, views, and external tables as data sources.
82
-
83
-
> success ""
84
-
> Visit Snowflake's docs to learn more about [schema priveleges](https://docs.snowflake.com/en/user-guide/security-access-control-privileges#schema-privileges){:target="_blank"} and [table priveleges](https://docs.snowflake.com/en/user-guide/security-access-control-privileges#table-privileges){:target="_blank"}.
### (If applicable) Add table permissions if Reverse ETL has ever run in your database
105
123
106
-
If you'd like to restrict access to specific tables, use the following command:
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.
If you've ever run Segment's [Reverse ETL](/docs/connections/reverse-etl/) in your database, you'll need to add the following [table permissions](https://docs.snowflake.com/en/user-guide/security-access-control-privileges#table-privileges){:target="_blank"}:
1. Log in as the user you've created (`segment_entities_user`).
129
-
2. Verify the role created has the correct permissions with the commands below.
140
+
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.
0 commit comments