Skip to content

Commit 0b96001

Browse files
committed
Code updates and edits from PM
1 parent 01c31b2 commit 0b96001

File tree

1 file changed

+52
-36
lines changed

1 file changed

+52
-36
lines changed

src/unify/linked-profiles/data-graph.md

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@ plan: unify
44
beta: true
55
---
66

7-
With Linked Profiles, you can build a Data Graph that defines relationships between any data set in the warehouse and the Segment Profiles you send with Profiles Sync.
7+
With Linked Profiles, you can build a Data Graph that defines relationships between any entity data set in the warehouse and the Segment Profiles you send with Profiles Sync.
88

9-
Define relationships between data from your warehouse to give marketers access to data to target, personalize, and analyze customer experiences.
9+
Make this relational data accessible to marketers and business stakeholders to empower them with the data they need to create targeted and personalized customer engagements.
1010

1111
> success ""
1212
> Segment's Data Graph powers [Linked Events](/docs/unify/linked-profiles/linked-events/) and [Linked Audiences](/docs/unify/linked-profiles/linked-audiences/).
1313
1414
## Prerequisites
1515

1616
To use the Data Graph, you'll need the following:
17-
- A Unify and Engage Foundations or Premier plan.
1817
- A Snowflake Data Warehouse.
19-
- [Profiles Sync](/docs/unify/profiles-sync/) set up with ready to use [data models and tables](/docs/unify/profiles-sync/tables/) in your warehouse.
2018
- An [Actions-based Destination](/docs/connections/destinations/actions/#available-actions-based-destinations).
2119

22-
2320
> info ""
2421
> Linked Profiles follows Zero Copy principles, and doesn't copy entities to store in Segment. Segment stores and processes all data in the United States.
2522
@@ -42,6 +39,9 @@ To track what data has been sent to Segment on previous syncs, Segment stores de
4239

4340
## Step 2: Connect your warehouse to the Data Graph
4441

42+
> warning "Segment user permissions"
43+
> You must have Workspace Owner or Unify Read-only/Admin and Entities Admin permissions to set up Linked Profiles.
44+
4545
> success ""
4646
> Before getting started with the Data Graph, be sure to [set up your Snowflake permissions](/unify/linked-profiles/setup-guides/snowflake-setup/).
4747
@@ -54,8 +54,6 @@ To connect your warehouse to the Data Graph:
5454
4. Enter your warehouse credentials.
5555
5. Test your connection, then click **Save**.
5656

57-
Depending on the size of your warehouse, it may take anywhere from a few minutes to an hour for Segment to sync your warehouse metadata to cache before you're able to set up your Data Graph.
58-
5957
## Step 3: Build your Data Graph
6058

6159
The Data Graph is a semantic layer that represents a subset of relevant business data that you'll use for audience targeting and personalization in downstream tools.
@@ -67,7 +65,7 @@ Use the configuration language spec below to add models to build your Data Graph
6765
> info ""
6866
> Each Unify space has one Data Graph. The current version is v0.0.6.
6967
70-
Segment recommends creating a new Linked Audience or Linked Event. Deleting and/or editing entities in the Data Graph may lead to errors if you reference these entities or relationships in existing Linked Audiences and Linked Events.
68+
Segment recommends creating a new Linked Audience or Linked Event. Deleting entities and relationships are not yet supported. Editing entities and relationships in the Data Graph may lead to errors if these entities or relationships are referenced in existing Linked Audiences and Linked Events.
7169

7270
While you can delete relationships or entities from the Data Graph, these relationships and entities will still display in the Linked Audience builder and Linked Events.
7371

@@ -80,7 +78,7 @@ Use the parameters, defintions, and examples below to help you define entities.
8078
8179
#### Profile
8280

83-
The profile is a special class of entity. The profile is always defined at the top of the Data Graph, and there can only be one profile for a Data Graph. The profile entity corresponds to the Profiles Sync tables and models.
81+
The profile is a special class of entity. The profile is always defined at the top of the Data Graph, and there can only be one profile for a Data Graph. The profile entity corresponds to the Profiles Sync tables and models, such as profile traits.
8482

8583
The parameters are:
8684

@@ -118,8 +116,9 @@ An entity is a stateful representation of a business object. The entity correspo
118116
```python
119117
# Define an entity and optionally indicate if the entity will be referenced for Linked Events (event enrichment)
120118

121-
entity "account" {
122-
table_ref = "cust.account"
119+
entity "account-entity" {
120+
name = "account"
121+
table_ref = "PRODUCTION.CUST.ACCOUNT"
123122
primary_key = "id"
124123
enrichment_enabled = true
125124
}
@@ -132,7 +131,7 @@ Use the following relationship, parameters, and examples to help you relate enti
132131
> warning ""
133132
> Snowflake schemas are case sensitive, so you'll need to reflect the schema, table, and column names based on how you case them in Snowflake.
134133
135-
134+
<!--Bookmark -->
136135
#### Relate Entity to Profile
137136

138137
| Parameters | Definition |
@@ -144,7 +143,14 @@ Use the following relationship, parameters, and examples to help you relate enti
144143

145144
A profile can be related to an entity in two ways:
146145
1. With an `external_id`: Define the external ID that will be used to join the profile with your entity.
147-
- `type`: Identify the external ID type (`email`, `phone`, `user id`). This corresponds to the `external_id_type` column in your `external_id_mapping` table.
146+
- `type`: Identify the external ID type (`email`, `phone`, `user id`). This corresponds to the `external_id_type` column in your `external_id_mapping` table. For example:
147+
```python
148+
relationship "user-carts" {
149+
name = "Shopping Carts"
150+
related_entity = "cart-entity"
151+
join_on = "ACCOUNT.ID = CART.ACCOUNT.ID"
152+
}
153+
```
148154
- `join_key`: This is the column on the entity table that you are matching to the external identifier.
149155
2. With a `trait`: Define a profile trait that will be used to join the profile with your entity.
150156
- `name`: The trait name that corresponds to a column name in your `profile_traits_updates` table.
@@ -209,6 +215,8 @@ data_graph {
209215

210216
```
211217

218+
#### relating entities with a junction table
219+
212220
If you're relating entities with a junction table:
213221

214222
- `Junction_table`: Define relationships between two entities tables joined by a junction table.
@@ -219,7 +227,8 @@ If you're relating entities with a junction table:
219227

220228
Note that `schema.table` is implied within the junction table column name and doesn't need to be provided.
221229

222-
Attributes from a junction table are not referenceable with the Audience Builder. If you'd like to reference an additional column on the junction table for filtering, you must first define it as an entity and explicitly define a relationship name.
230+
> warning ""
231+
> Attributes from a junction table are not referenceable with the Audience Builder. If you'd like to reference an additional column on the junction table for filtering, you must first define it as an entity and explicitly define a relationship name.
223232
224233
```py
225234
#relating entities with junction table
@@ -230,14 +239,15 @@ data_graph {
230239
#define profile
231240
...
232241
#relate products to carts
233-
relationship "Products" {
234-
related_entity = "product"
242+
relationship "products" {
243+
name = "Purchased Products"
244+
related_entity = "product-entity"
235245
junction_table {
236246
primary_key = "id"
237-
table_ref = "customer.cart_product"
238-
left_join_on = "cart.id = cart_id"
247+
table_ref = "PRODUCTION.CUSTOM.CART_PRODUCT"
248+
left_join_on = "CART.ID = CART_ID"
239249
#schema.table is implied within the cart_id key
240-
right_join_on = "product_id = product.sku"
250+
right_join_on = "PRODUCT_ID = PRODUCT.SKU"
241251
}
242252

243253
}
@@ -259,48 +269,54 @@ data_graph {
259269
materialization = "none"
260270

261271
#relate profile to accounts
262-
relationship "Accounts" {
263-
related_entity = "account"
272+
relationship "user-accounts" {
273+
name = "Premium Accounts"
274+
related_entity = "account-entity"
264275
external_id {
265276
type = "email"
266277
join_key = "email_id"
267278
}
268279

269280
#relate account to carts
270-
relationship "Carts" {
271-
related_entity = "cart"
272-
join_on = "account.id = cart.account_id"
281+
relationship "user-carts" {
282+
name = "Shopping Carts"
283+
related_entity = "cart-entity"
284+
join_on = "ACCOUNT.ID = CART.ACCOUNT_ID"
273285

274286
#relate products to carts
275-
relationship "Products" {
276-
related_entity = "product"
287+
relationship "products" {
288+
name = "Purchased Products"
289+
related_entity = "product-entity"
277290
junction_table {
278-
primary_key = "id"
279-
table_ref = "customer.cart_product"
280-
left_join_on = "cart.id = cart_id"
291+
primary_key = "id"
292+
table_ref = "PRODUCTION.CUSTOMER.CART_PRODUCT"
293+
left_join_on = "CART.ID = CART_ID"
281294
#schema.table is implied within the cart_id key
282-
right_join_on = "product_id = product.sku"
295+
right_join_on = "PRODUCT_ID = PRODUCT.SKU"
283296
}
284297
}
285298
}
286299
}
287300
}
288301

289302
#define account, product, and cart entities
290-
entity "account" {
291-
table_ref = "cust.account"
303+
entity "account-entity" {
304+
name = "account"
305+
table_ref = "PRODUCTION.CUST.ACCOUNT"
292306
primary_key = "id"
293307
enrichment_enabled = true
294308
}
295309

296-
entity "product" {
297-
table_ref = "prod.product_skus"
310+
entity "product-entity" {
311+
name = "product"
312+
table_ref = "PRODUCTION.PROD.PRODUCT_SKUS"
298313
primary_key = "sku"
299314
enrichment_enabled = true
300315
}
301316

302-
entity "cart" {
303-
table_ref = "cust.cart"
317+
entity "cart-entity" {
318+
name = "cart"
319+
table_ref = "PRODUCTION.CUST.CART"
304320
primary_key = "id"
305321
}
306322
}

0 commit comments

Comments
 (0)