Skip to content

Commit d09ae7a

Browse files
committed
edits [netlify-build]
1 parent b452038 commit d09ae7a

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

src/unify/data-graph/setup-guides/redshift-setup.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ redirect_from:
1111
1212
Set up your Redshift data warehouse to Segment for the [Data Graph](/docs/unify/data-graph/).
1313

14-
## Prerequisites
14+
## Prerequisite
1515

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).
1717

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.
1924

2025
## Getting started
2126

@@ -28,33 +33,26 @@ To get started with Redshift:
2833
## Step 1: Roles and permissions
2934
Segment recommends you to create a new Redshift user and role with only the required permissions.
3035

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:
3237

33-
```
38+
```sql
3439
-- Create a user with role for the Data Graph
3540
CREATE ROLE SEGMENT_LINKED_ROLE;
3641
CREATE USER SEGMENT_LINKED_USER PASSWORD "your_password";
3742
GRANT ROLE SEGMENT_LINKED_ROLE TO SEGMENT_LINKED_USER;
3843
```
3944

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-
4245
## Step 2: Create a database for Segment to store checkpoint tables
4346

4447
> 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.
4849
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.
5151

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:
5653

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
5856

5957
CREATE DATABASE SEGMENT_LINKED_PROFILES_DB;
6058
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
6866
### Schemas
6967
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.
7068

71-
```
69+
```sql
7270
-- ********** REPEAT THE SQL QUERY BELOW FOR EACH SCHEMA YOU WANT TO USE FOR THE DATA GRAPH **********
7371

7472
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;
7876
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"}.
7977

8078
Table permissions can either be handled in bulk:
81-
```
79+
80+
```sql
8281
-- query data from a all tables in a schema
8382
GRANT SELECT ON ALL TABLES IN SCHEMA "the_schema_name" TO ROLE SEGMENT_LINKED_ROLE;
8483
```
8584

8685
Or in a more granular fashion if needed:
87-
```
86+
87+
```sql
8888
-- query data from a specific table in a schema
8989
GRANT SELECT ON TABLE <schema-name>.<table-name> TO ROLE segment_linked_role;
9090
```
9191

9292
## Step 4: Validate permissions
9393
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.
9494

95-
```
95+
```sql
9696
SHOW SCHEMAS FROM DATABASE "THE_READ_ONLY_DB";
9797
SELECT * FROM "THE_READ_ONLY_DB.A_SCHEMA.SOME_TABLE" LIMIT 10;
9898
```
@@ -106,19 +106,18 @@ To connect your warehouse to Segment:
106106
* **Host Name:** The Redshift URL
107107
* **Port:** The Redshift connection port
108108
* **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.
110110
* **Password:** The password of the user above
111111
5. Test your connection, then click **Save**.
112112

113113
## Update user access for Segment Reverse ETL dataset
114114
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`.
115115

116116
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.
119117

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.
122120

121+
GRANT USAGE, CREATE, DROP ON SCHEMA segment_connection_db.__segment_reverse_etl TO ROLE SEGMENT_LINKED_ROLE;
123122
GRANT SELECT,INSERT,UPDATE,DELETE,DROP ON ALL TABLES IN SCHEMA segment_connection_db.__segment_reverse_etl TO ROLE SEGMENT_LINKED_ROLE;
124123
```

0 commit comments

Comments
 (0)