Skip to content

Commit 30dff1e

Browse files
authored
Merge pull request #7554 from segmentio/redshift-bigquery-ga-updates
Redshift/BigQuery Linked Audiences GA + Materialized view requirements [DOC-1094]
2 parents 8530cdd + 026d2a7 commit 30dff1e

File tree

5 files changed

+37
-32
lines changed

5 files changed

+37
-32
lines changed

src/unify/data-graph/index.md

+29-24
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ The Data Graph acts as a semantic layer that allows businesses to define relatio
1313

1414
## Prerequisites
1515

16+
> info "Why you need both materialized and unmaterialized tables"
17+
> Segment recommends using materialized views for Profiles Sync to optimize performance and reduce query costs with Linked Audiences. However, due to schema inference requirements, you still need to select the matching **unmaterialized tables** as well. Segment relies on the unmaterialized tables during setup, even if they’re not used when queries run.
18+
1619
To use the Data Graph, you'll need the following:
1720

1821
- A supported data warehouse with the appropriate Data Graph permissions
1922
- Workspace Owner or Unify Read-only/Admin and Entities Admin permissions
2023
- For Linked Audiences, set up [Profiles Sync](/docs/unify/profiles-sync/) in a Unify space with ready-to-use [data models and tables](/docs/unify/profiles-sync/tables/) in your warehouse. When setting up selective sync, Segment recommends the following settings:
2124
- Under **Profile materialized tables**, select all the tables (`user_identifier`, `user_traits`, `profile_merges`) for faster and more cost-efficient Linked Audiences computations in your data warehouse.
25+
- **Make sure to include the unmaterialized tables as well**. Segment needs them during setup to understand your schema.
2226
- Under **Track event tables**, select **Sync all Track Call Tables** to enable filtering on event history for Linked Audiences conditions.
2327

2428
> info ""
@@ -29,7 +33,7 @@ To use the Data Graph, you'll need the following:
2933
> Data Graph, Reverse ETL, and Profiles Sync require different warehouse permissions.
3034
3135
To get started with the Data Graph, set up the required permissions in your warehouse. Segment supports the following:
32-
- Linked Audiences: [BigQuery](/docs/unify/data-graph/setup-guides/BigQuery-setup/), [Databricks](/docs/unify/data-graph/setup-guides/databricks-setup/), and [Snowflake](/docs/unify/data-graph/setup-guides/snowflake-setup/)
36+
- Linked Audiences: [BigQuery](/docs/unify/data-graph/setup-guides/BigQuery-setup/), [Databricks](/docs/unify/data-graph/setup-guides/databricks-setup/), [Redshift](/docs/unify/data-graph/setup-guides/redshift-setup/), and [Snowflake](/docs/unify/data-graph/setup-guides/snowflake-setup/)
3337
- Linked Events: [BigQuery](/docs/unify/data-graph/setup-guides/BigQuery-setup/), [Databricks](/docs/unify/data-graph/setup-guides/databricks-setup/), [Redshift](/docs/unify/data-graph/setup-guides/redshift-setup/), and [Snowflake](/docs/unify/data-graph/setup-guides/snowflake-setup/)
3438

3539
To track the data sent to Segment on previous syncs, Segment uses [Reverse ETL](/docs/connections/reverse-etl/) infrastructure to store diffs in tables within a dedicated schema called `_segment_reverse_etl` in your data warehouse. You can choose which database or project in your warehouse this data lives in.
@@ -107,8 +111,8 @@ data_graph {
107111
primary_key = "SUB_ID"
108112
}
109113

110-
# Define the profile entity, which corresponds to Segment Profiles tables synced via Profiles Sync
111-
# Recommend setting up Profiles Sync materialized views to optimize warehouse compute costs
114+
# Define the profile entity, which corresponds to Segment Profiles tables synced with Profiles Sync
115+
# Use materialized views in Profiles Sync to reduce query costs and speed things up
112116
profile {
113117
profile_folder = "PRODUCTION.SEGMENT"
114118
type = "segment:materialized"
@@ -118,22 +122,22 @@ data_graph {
118122
relationship "user-accounts" {
119123
name = "Premium Accounts"
120124
related_entity = "account-entity"
121-
# Join the profile entity with an identifier (e.g. email) on the related entity table
125+
# Join the profile entity with an identifier (like email) on the related entity table
122126
# Option to replace with the trait block below to join with a profile trait on the entity table instead
123127
external_id {
124128
type = "email"
125129
join_key = "EMAIL_ID"
126130
}
127131

128132
# Define 1:many relationship between accounts and carts
129-
# e.g. an account can be associated with many carts
133+
# for example, an account can be associated with many carts
130134
relationship "user-carts" {
131135
name = "Shopping Carts"
132136
related_entity = "cart-entity"
133137
join_on = "account-entity.ID = cart-entity.ACCOUNT_ID"
134138

135139
# Define many:many relationship between carts and products
136-
# e.g. there can be multiple carts, and each cart can be associated with multiple products
140+
# for example, there can be multiple carts, and each cart can be associated with multiple products
137141
relationship "products" {
138142
name = "Purchased Products"
139143
related_entity = "product-entity"
@@ -157,7 +161,7 @@ data_graph {
157161
}
158162

159163
# Define 1:many relationship between households and subscriptions
160-
# e.g. a household can be associated with multiple subscriptions
164+
# for example, a household can be associated with multiple subscriptions
161165
relationship "user-subscriptions" {
162166
name = "Subscriptions"
163167
related_entity = "subscription-entity"
@@ -203,10 +207,10 @@ data_graph {
203207

204208
Next, define the profile. This is a special class of entity that represents Segment Profiles, which corresponds to the Profiles Sync tables and models. For Linked Audiences, this allows marketers to filter on profile traits, event history, etc. There can only be one profile for a Data Graph.
205209

206-
| Parameters | Definition |
207-
| ----------- | --------------------------------------------------------------------- |
208-
| `profile_folder` | Define the fully qualified path of the folder or schema location for the profile tables. |
209-
| `type` | Identify the materialization method of the profile tables defined in your Profiles Sync configuration under [Selective Sync settings](/docs/unify/profiles-sync/profiles-sync-setup/#step-3-set-up-selective-sync): `segment:unmaterialized` or `segment:materialized`.|
210+
| Parameters | Definition |
211+
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
212+
| `profile_folder` | Define the fully qualified path of the folder or schema location for the profile tables. |
213+
| `type` | Use `segment:materialized` to sync materialized views with Profiles Sync. Segment recommends this configuration for all Linked Audiences and Data Graph setups. If you can't sync materialized views, [reach out to Segment support](https://segment.com/help/contact/){:target="_blank"} for help. |
210214

211215
**Example:**
212216

@@ -238,23 +242,24 @@ This is the first level of relationships and a unique type of relationship betwe
238242

239243
| Parameters | Definition |
240244
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
241-
| `relationship` | An immutable slug for the relationship, and will be treated as a delete if you make changes. The slug must be in all lowercase, and supports dashes or underscores (e.g. `user-account` or `user_account`) |
245+
| `relationship` | An immutable slug for the relationship, and will be treated as a delete if you make changes. The slug must be in all lowercase, and supports dashes or underscores (like `user-account` or `user_account`) |
242246
| `name` | A label displayed throughout your Segment space for Linked Events, Linked Audiences, etc. This name can be modified at any time |
243247
| `related_entity` | References your already defined entity |
244248

245249
To define a profile-to-entity relationship, reference your entity table and depending on your table columns, choose to join on one of the following:
246250

247-
**Option 1 (Most common) - Join on an external ID:** Use the `external_id` block to join the profile entity with an entity table using external IDs from your [Unify ID resolution](/docs/unify/identity-resolution/externalids/) settings. Typically these identifiers are `user_id`, `email`, or `phone` depending on the column in the entity table that you want to join with.
248-
- `type`: Represents the [external ID type](/docs/unify/identity-resolution/externalids/#default-externalids) (`email`, `phone`, `user_id`) in your id-res settings. Depending on if you are using materialized or unmaterialized profiles, these correspond to different columns in your Profiles Sync warehouse tables:
249-
- [Materialized](/docs/unify/profiles-sync/tables/#the-user_identifiers-table) (Recommended): This corresponds to the `type` column in your Profiles Sync `user_identifiers` table.
250-
- [Unmaterialized](/docs/unify/profiles-sync/tables/#the-external_id_mapping_updates-table): This corresponds to the `external_id_type` column in your Profiles Sync `external_id_mapping_updates` table.
251-
- `join_key`: This is the column on the entity table that you are matching to the external identifier.
251+
**Option 1 (Most common) - Join on an external ID:** Use the `external_id` block to join the profile entity with an entity table using external IDs from your [Unify ID resolution](/docs/unify/identity-resolution/externalids/) settings. Typically these identifiers are `user_id`, `email`, or `phone` depending on the structure of your entity table.
252+
- `type`: Represents the [external ID type](/docs/unify/identity-resolution/externalids/#default-externalids) (`email`, `phone`, `user_id`) in your ID resolution settings.
253+
- This maps to the `type` column in the `user_identifiers` table when using materialized views.
254+
- `join_key`: The column on the entity table that matches the external ID.
255+
256+
> note ""
257+
> Segment recommends using materialized views with Profiles Sync. However, Segment may still reference unmaterialized tables during setup for schema detection.
252258

253259
**Option 2 - Join on a profile trait:** Use the `trait` block to join the profile entity with an entity table using [Profile Traits](/docs/unify/#enrich-profiles-with-traits).
254-
- `name`: Represents a trait name in your Unify profiles. Depending on if you are using materialized or unmaterialized profiles, these correspond to different columns in your Profiles Sync warehouse tables:
255-
- [Materialized](/docs/unify/profiles-sync/tables/#the-profile_traits-table) (Recommended): The trait name corresponds to a unique value of the `name` column in your Profiles Sync `user_traits` table.
256-
- [Unmaterialized](/docs/unify/profiles-sync/tables/#the-profile_traits_updates-table): This corresponds to a column in the Profile Sync `profile_trait_updates` table.
257-
- `join_key`: This is the column on the entity table that you are matching to the trait.
260+
- `name`: Represents a trait name in your Unify profiles.
261+
- This maps to the `name` column in the `user_traits` table when using materialized views.
262+
- `join_key`: The column on the entity table that you're matching to the trait.
258263

259264
**Example:**
260265
```python
@@ -277,7 +282,7 @@ data_graph {
277282
name = "Premium Accounts"
278283
related_entity = "account-entity"
279284

280-
# Option 1: Join the profile entity with an identifier (e.g. email) on the related entity table
285+
# Option 1: Join the profile entity with an identifier (like email) on the related entity table
281286
external_id {
282287
type = "email"
283288
join_key = "EMAIL_ID"
@@ -298,7 +303,7 @@ For 1:many relationships, define the join on between the two entity tables using
298303

299304
| Parameters | Definition |
300305
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
301-
| `relationship` | An immutable slug for the relationship, and will be treated as a delete if you make changes. The slug must be in all lowercase, and supports dashes or underscores (e.g. `user-account` or `user_account`) |
306+
| `relationship` | An immutable slug for the relationship, and will be treated as a delete if you make changes. The slug must be in all lowercase, and supports dashes or underscores (like `user-account` or `user_account`) |
302307
| `name` | A label displayed throughout your Segment space for Linked Events, Linked Audiences, and so on. This name can be modified at any time |
303308
| `related_entity` | References your already defined entity |
304309
| `join_on` | Defines relationship between the two entity tables `[lefty entity slug].[column name] = [right entity slug].[column name]`. Note that since you’re referencing the entity slug for the join on, you do not need to define the full table reference |
@@ -343,7 +348,7 @@ For many:many relationships, define the join on between the two entity tables wi
343348

344349
| Parameters | Definition |
345350
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
346-
| `relationship` | An immutable slug for the relationship, and will be treated as a delete if you make changes. The slug must be in all lowercase, and supports dashes or underscores (e.g. `user-account` or `user_account`) |
351+
| `relationship` | An immutable slug for the relationship, and will be treated as a delete if you make changes. The slug must be in all lowercase, and supports dashes or underscores (like `user-account` or `user_account`) |
347352
| `name` | A label displayed throughout your Segment space for Linked Events, Linked Audiences, and so on. This name can be modified at any time |
348353
| `related_entity` | References your already defined entity |
349354

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ redirect_from:
66
- '/unify/linked-profiles/setup-guides/BigQuery-setup'
77
---
88

9-
> info ""
10-
> BigQuery for Data Graph is in beta and Segment is actively working on this feature. Some functionality may change before it becomes generally available. This feature is governed by Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}.
9+
> warning ""
10+
> Data Graph, Reverse ETL, and Profiles Sync require different warehouse permissions.
1111
1212
Set up your BigQuery data warehouse to Segment for the [Data Graph](/docs/unify/data-graph/data-graph/).
1313

14-
1514
## Step 1: Roles and permissions
1615
> warning ""
1716
> You need to be an account admin to set up the Segment BigQuery connector as well as write permissions for the `__segment_reverse_etl` dataset.

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

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ redirect_from:
55
- '/unify/linked-profiles/setup-guides/databricks-setup'
66
---
77

8+
> warning ""
9+
> Data Graph, Reverse ETL, and Profiles Sync require different warehouse permissions.
10+
811
On this page, you'll learn how to connect your Databricks data warehouse to Segment for the [Data Graph](/docs/unify/data-graph/data-graph/).
912

1013
## Databricks credentials

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ redirect_from:
66
- '/unify/linked-profiles/setup-guides/redshift-setup'
77
---
88

9-
> info ""
10-
> Redshift for Data Graph is in beta and Segment is actively working on this feature. Some functionality may change before it becomes generally available. This feature is governed by Twilio Segment’s [First Access and Beta Preview Terms](https://www.twilio.com/en-us/legal/tos){:target="_blank"}.
9+
> warning ""
10+
> Data Graph, Reverse ETL, and Profiles Sync require different warehouse permissions.
1111
1212
Set up your Redshift data warehouse to Segment for the [Data Graph](/docs/unify/data-graph/).
1313

1414
## Prerequisite
1515

16-
To use Linked Audiences with Redshift, the Data Graph only supports [materialized views](/docs/unify/profiles-sync/tables/#tables-segment-materializes).
17-
1816
If you're setting up Profiles Sync for the first time in the Unify space, go through the setup flow for Selective sync. If Profiles Sync is already set up for your Unify space, follow these steps to configure Profiles Sync for your Unify space:
1917

2018
1. Navigate to **Unify > Profile Sync**.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ redirect_from:
55
- '/unify/linked-profiles/setup-guides/snowflake-setup'
66
---
77
> warning ""
8-
> Data Graph, Reverse ETL, Profiles Sync require different warehouse permissions.
8+
> Data Graph, Reverse ETL, and Profiles Sync require different warehouse permissions.
99
1010
On this page, you'll learn how to connect your Snowflake data warehouse to Segment for the [Data Graph](/docs/unify/data-graph/data-graph/).
1111

0 commit comments

Comments
 (0)