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/data-graph.md
+28-23Lines changed: 28 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,6 @@ The Data Graph is a semantic layer unifying all your customer datasets, enabling
11
11
-**[Linked Audiences](/docs/engage/audiences/linked-audiences/)**: Enables marketers to self-serve and build targeting logic based on any data sets defined in the Data Graph unlocking a world of new hyper-personalized campaigns.
12
12
-**[Linked Events](/docs/unify/data-graph/linked-events/)**: Enables data teams to enrich event streams, in real time, with any data set coming from a data warehouse or data lake, and send those enriched events to any Destination. Available for Destinations Actions and Functions.
13
13
14
-
> info ""
15
-
> Data Graph currently only supports workspaces in the United States.
16
-
17
14
## Prerequisites
18
15
19
16
To use the Data Graph, you'll need the following:
@@ -31,10 +28,13 @@ To get started with the Data Graph, set up the required permissions in your ware
To track what data has been sent to Segment on previous syncs, Segment leverages Reverse ETL infrastructure to store diffs in tables within a single schema called `_segment_reverse_etl` in your data warehouse. You can choose which database or project in your warehouse this data lives in.
34
+
> info ""
35
+
> Data Graph currently only supports workspaces in the United States.
36
+
37
+
To track what data has been sent to Segment on previous syncs, Segment leverages [Reverse ETL](/docs/connections/reverse-etl/) infrastructure to store diffs in tables within a single schema called `_segment_reverse_etl` in your data warehouse. You can choose which database or project in your warehouse this data lives in.
38
38
39
39
## Step 2: Connect your warehouse to the Data Graph
40
40
@@ -77,6 +77,7 @@ data_graph {
77
77
}
78
78
}
79
79
relationship "d" {
80
+
...
80
81
}
81
82
}
82
83
}
@@ -88,11 +89,11 @@ The first step in creating a Data Graph is to define your entities. An entity co
|`entity`| An immutable slug for the entity, 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 `account-entity` or `account_entity`) |
92
-
|`name`| A label displayed throughout your Segment space for Linked Events, Linked Audiences, etc. This name can be modified at any time |
93
-
|`table_ref`| Defines the fully qualified table reference: `[database name].[schema name].[table name]`. Segment flexibly supports tables, views and materialized views |
94
-
|`primary_key`| The unique identifier for the given table. Must be a column with unique values per row |
95
-
| (Optional) `enrichment_enabled = true`| Add this if you plan to reference the entity table for [Linked Events](/docs/unify/data-graph/linked-events/) use cases |
92
+
|`entity`| An immutable slug for the entity, 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 `account-entity` or `account_entity`).|
93
+
|`name`| A label displayed throughout your Segment space for Linked Events, Linked Audiences, etc. This name can be modified at any time.|
94
+
|`table_ref`| Defines the fully qualified table reference: `[database name].[schema name].[table name]`. Segment flexibly supports tables, views and materialized views.|
95
+
|`primary_key`| The unique identifier for the given table. Must be a column with unique values per row.|
96
+
| (If applicable) `enrichment_enabled = true`| Add this if you plan to reference the entity table for [Linked Events](/docs/unify/data-graph/linked-events/) use cases.|
96
97
97
98
**Example:**
98
99
@@ -121,8 +122,8 @@ Next, define the profile. This is a special class of entity that represents Segm
|`profile_folder`| Define the fully qualified path of the folder or schema location for the profile tables |
125
-
|`type`| Identify the materialization method of the profile tables defined in your Profiles Sync configuration (`segment:unmaterialized`, `segment:materialized`)|
125
+
|`profile_folder`| Define the fully qualified path of the folder or schema location for the profile tables.|
126
+
|`type`| Identify the materialization method of the profile tables defined in your Profiles Sync configuration: `segment:unmaterialized` or `segment:materialized`.|
126
127
127
128
**Example:**
128
129
@@ -144,13 +145,13 @@ data_graph {
144
145
### c) Define relationships
145
146
146
147
Now define your relationships between your entities. The Data Graph supports three types of relationships:
147
-
- Profile-to-entity relationship. This is the first level of relationships
148
+
- Profile:entity relationship. This is the first level of relationships
148
149
- 1:many relationship
149
150
- Many:many relationship
150
151
151
-
All relationship types require you to define the relationship slug, label, and related entity. Each type of relationship has unique join on conditions.
152
+
All relationship types require you to define the relationship slug, name, and related entity. Each type of relationship has unique join on conditions.
152
153
153
-
#### Define profile-to-entity relationship
154
+
#### Define profile:entity relationship
154
155
This is the first level of relationships and a unique type of relationship between Segment profile entity and a related entity.
155
156
156
157
| Parameters | Definition |
@@ -159,15 +160,19 @@ This is the first level of relationships and a unique type of relationship betwe
159
160
|`name`| A label displayed throughout your Segment space for Linked Events, Linked Audiences, etc. This name can be modified at any time |
160
161
|`related_entity`| References your already defined entity |
161
162
162
-
To define a profile-to-entity relationship, choose to join on one of the following:
163
+
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:
163
164
164
-
**Option 1 (Most common):** Use the `external_id` block to join the profile entity with `user_id`, `email`, or `phone` as the identifier on the entity table
165
-
-`type`: Identify the external ID type (`email`, `phone`, `user id`). This corresponds to the `external_id_type` column in your Profiles Sync `external_id_mapping` table
166
-
-`join_key`: This is the column on the entity table that you are matching to the external identifier
165
+
**Option 1 (Most common):** 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.
166
+
-`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:
167
+
-[Materialized](/docs/unify/profiles-sync/tables/#the-user_identifiers-table) (Recommended): This corresponds to the `type` column in your Profiles Sync `user_identifiers` table.
168
+
-[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.
169
+
-`join_key`: This is the column on the entity table that you are matching to the external identifier.
167
170
168
-
**Option 2:** Use the `traits` block to join with a profile trait on the entity table
169
-
-`name`: The trait name that corresponds to a column name in your Profiles Sync `profile_traits_updates` table
170
-
-`join_key`: This is the column on the entity table that you are matching to the trait
171
+
**Option 2:** Use the `traits` block to join the profile entity with an entity table using [Profile Traits](/docs/unify/#enrich-profiles-with-traits).
172
+
-`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:
173
+
-[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.
174
+
-[Unmaterialized](/docs/unify/profiles-sync/tables/#the-profile_traits_updates-table): This corresponds to a column in the Profile Sync `profile_trait_updates` table.
175
+
-`join_key`: This is the column on the entity table that you are matching to the trait.
0 commit comments