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/data-graph/setup-guides/redshift-setup.md
+25-26Lines changed: 25 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,16 @@ redirect_from:
11
11
12
12
Set up your Redshift data warehouse to Segment for the [Data Graph](/docs/unify/data-graph/).
13
13
14
-
## Prerequisites
14
+
## Prerequisite
15
15
16
-
To use Linked Audiences with Redshift, Segment requires you to configure [Profiles Synce materialized views for the Data Graph](/docs/unify/data-graph/#prerequisites). You can read more about [Profile Sync materialized views](/docs/unify/profiles-sync/tables/#tables-segment-materializes).
16
+
To use Linked Audiences with Redshift, the Data Graph only supports [materialized views](/docs/unify/profiles-sync/tables/#tables-segment-materializes).
17
17
18
-
Even though Segment only supports Profile Sync materialized tables for the Data Graph, Linked Audiences require Profile Sync to be configured such that both the [Profile raw tables](/docs/unify/profiles-sync/tables/#profile-raw-tables) and the [Profile materialized tables](/docs/unify/profiles-sync/tables/#tables-segment-materializes) are synchronized with your Redshift instance.
18
+
To configure Profiles Sync for your Unify space:
19
+
1. Navigate to **Unify > Profile Sync**.
20
+
2. Select the **Settings** tab and select **Selective sync**.
21
+
3. Select all the tables under **Profile raw tables**. These include, `external_id_mapping_updates`, `id_graph_updates`, `profile_traits_updates`. Linked Audiences require Profile Sync to be configured such that both the Profile raw tables and the Profile materialized tables are synchronized with your Redshift instance.
22
+
4. Select all of the tables under **Profile materialized tables**. These include, `profile_merges`, `user_traits`, `user_identifiers`. This allows faster and more cost-efficient Linked Audiences computations in your data warehouse.
23
+
5. Select **Sync all Track Call Tables** under **Track event tables** to enable filtering on event history for Linked Audiences conditions.
19
24
20
25
## Getting started
21
26
@@ -28,33 +33,26 @@ To get started with Redshift:
28
33
## Step 1: Roles and permissions
29
34
Segment recommends you to create a new Redshift user and role with only the required permissions.
30
35
31
-
1.Create a new role and user for the Segment Data Graph. This new role will only have access to the datasets you provide access to for the Data Graph. Run the SQL commands in your Redshift cluster:
36
+
Create a new role and user for the Segment Data Graph. This new role will only have access to the datasets you provide access to for the Data Graph. Run the SQL commands in your Redshift cluster:
GRANT ROLE SEGMENT_LINKED_ROLE TO SEGMENT_LINKED_USER;
38
43
```
39
44
40
-
2. Provide write access to the database as Segment requires this in order to create a schema for internal bookkeeping and to store checkpoint tables for the queries that are executed. Segment recommends you to create a new database for this purpose. This is also the database you'll be required to specify for the **Database Name** when connecting Redshift with the Segment app.
41
-
42
45
## Step 2: Create a database for Segment to store checkpoint tables
43
46
44
47
> info ""
45
-
> Segment recommends you to create a new database for the Data Graph. If you choose to use an existing database that has also been used for [Segment Reverse ETL](/docs/connections/reverse-etl/), you must follow the [additional instructions](#update-user-access-for-segment-reverse-etl-schema) to update user access for the Segment Reverse ETL schema.
46
-
47
-
Run the following SQL commands in your Redshift cluster:
48
+
> Segment recommends you to create a new database for the Data Graph. If you choose to use an existing database that has also been used for [Segment Reverse ETL](/docs/connections/reverse-etl/), you must follow the [additional instructions](#update-user-access-for-segment-reverse-etl-dataset) to update user access for the Segment Reverse ETL schema.
48
49
49
-
```
50
-
-- ******** SET UP THE FOLLOWING WAREHOUSE PERMISSIONS ********
50
+
Provide write access to the database as Segment requires this in order to create a schema for internal bookkeeping and to store checkpoint tables for the queries that are executed. Segment recommends you to create a new database for this purpose. This is also the database you'll be required to specify for the **Database Name** when connecting Redshift with the Segment app.
51
51
52
-
-- Create a user with role for the Data Graph
53
-
CREATE ROLE SEGMENT_LINKED_ROLE;
54
-
CREATE USER SEGMENT_LINKED_USER PASSWORD "your_password";
55
-
GRANT ROLE SEGMENT_LINKED_ROLE TO SEGMENT_LINKED_USER;
52
+
Run the following SQL commands in your Redshift cluster:
56
53
57
-
-- Create and Grant access to a Segment internal DB used for bookkeeping. This is the only DB that Segment requires write access to. This is also the DB you will use in the "Database Name" config while setting up the connection in the Segment app.
54
+
```sql
55
+
-- Create and Grant access to a Segment internal DB used for bookkeeping
58
56
59
57
CREATEDATABASESEGMENT_LINKED_PROFILES_DB;
60
58
GRANT CREATE ON DATABASE SEGMENT_LINKED_PROFILES_DB TO ROLE SEGMENT_LINKED_ROLE;
@@ -68,7 +66,7 @@ To locate the Profile Sync database, navigate to **Unify > Profiles Sync > Setti
68
66
### Schemas
69
67
Grant schema permissions based on customer need. See Amazon’s docs to view [schema permissions](https://docs.aws.amazon.com/redshift/latest/dg/r_GRANT.html){:target="_blank"} and [example commands](https://docs.aws.amazon.com/redshift/latest/dg/r_GRANT-examples.html){:target="_blank"} that you can use to grant permissions. Repeat the following SQL query for each schema you want to use for the Data Graph.
70
68
71
-
```
69
+
```sql
72
70
-- ********** REPEAT THE SQL QUERY BELOW FOR EACH SCHEMA YOU WANT TO USE FOR THE DATA GRAPH **********
73
71
74
72
GRANT USAGE ON SCHEMA "the_schema_name" TO ROLE SEGMENT_LINKED_ROLE;
@@ -78,21 +76,23 @@ GRANT USAGE ON SCHEMA "the_schema_name" TO ROLE SEGMENT_LINKED_ROLE;
78
76
Grant table permissions based on your needs. Learn more about [Amazon’s table permissions](https://docs.aws.amazon.com/redshift/latest/dg/r_GRANT.html){:target="_blank"}.
79
77
80
78
Table permissions can either be handled in bulk:
81
-
```
79
+
80
+
```sql
82
81
-- query data from a all tables in a schema
83
82
GRANTSELECTON ALL TABLES IN SCHEMA "the_schema_name" TO ROLE SEGMENT_LINKED_ROLE;
84
83
```
85
84
86
85
Or in a more granular fashion if needed:
87
-
```
86
+
87
+
```sql
88
88
-- query data from a specific table in a schema
89
89
GRANTSELECTON TABLE <schema-name>.<table-name> TO ROLE segment_linked_role;
90
90
```
91
91
92
92
## Step 4: Validate permissions
93
93
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. If this command succeeds, you should be able to view the respective table.
@@ -106,19 +106,18 @@ To connect your warehouse to Segment:
106
106
***Host Name:** The Redshift URL
107
107
***Port:** The Redshift connection port
108
108
***Database:** The only database that Segment requires write access to in order to create tables for internal bookkeeping. This database is referred to as `segment_linked_profiles_db` in the SQL above
109
-
***Username:** The Redshift user that Segment uses to run SQL in your warehouse. This user is referred to as `segment_linked_user` in the sql above
109
+
***Username:** The Redshift user that Segment uses to run SQL in your warehouse. This user is referred to as `segment_linked_user` in the SQL above.
110
110
***Password:** The password of the user above
111
111
5. Test your connection, then click **Save**.
112
112
113
113
## Update user access for Segment Reverse ETL dataset
114
114
If Segment Reverse ETL ran in the project you are configuring as the Segment connection project, a Segment-managed dataset is already created, and you need to provide the new Segment user access to the existing dataset. Run the following SQL if you run into an error on the Segment app indicating that the user doesn’t have sufficient privileges on an existing `__segment_reverse_etl`.
115
115
116
116
Run the following command:
117
-
```
118
-
-- If you want to use an existing database that already has Segment Reverse ETL schemas, you’ll need to run some additional steps below to grant the role access to the existing schemas.
119
117
120
-
GRANT USAGE, CREAT, DROP ON SCHEMA segment_connection_db.__segment_reverse_etl TO ROLE SEGMENT_LINKED_ROLE;
121
-
GRANT CREATE TABLE ON SCHEMA identifier($retl_schema) TO ROLE SEGMENT_LINKED_ROLE;
118
+
```sql
119
+
-- If you want to use an existing database that already has Segment Reverse ETL schemas, you’ll need to run some additional steps below to grant the role access to the existing schemas.
122
120
121
+
GRANT USAGE, CREATE, DROP ON SCHEMA segment_connection_db.__segment_reverse_etl TO ROLE SEGMENT_LINKED_ROLE;
123
122
GRANTSELECT,INSERT,UPDATE,DELETE,DROP ON ALL TABLES IN SCHEMA segment_connection_db.__segment_reverse_etl TO ROLE SEGMENT_LINKED_ROLE;
0 commit comments