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/profiles-sync/tables.md
+86Lines changed: 86 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -220,6 +220,92 @@ If your space has the same name as a source connected to your Segment Warehouse
220
220
Follow the steps below to change your schema name:
221
221
{% endcomment %}
222
222
223
+
## Tables Segment materializes
224
+
225
+
If you use Snowflake or BigQuery, Segment offers three materialized view tables. Visit the [selective sync](/docs/unify/profiles-sync/#using-selective-sync) setup page to enable the following materialized tables, which Segment disables by default.
226
+
227
+
You can also use [historical backfill](/docs/unify/profiles-sync/#using-historical-backfill) with tables Segment materializes.
228
+
229
+
> warning ""
230
+
> For materialized view tables, you must have delete permissions for your data warehouse.
231
+
232
+
233
+
### The user_traits table
234
+
235
+
With the `user_traits` table, you'll see a complete user profile that combines Profiles Sync data with external data sources such as customer purchase history, product usage, and more.
236
+
237
+
The `user_traits` table contains all traits that belong to a profile represented by the `canonical_segment_id`.
238
+
- This view is a fixed schema, and contains a row for each trait associated with the profile.
239
+
- If new traits are added to the profile, new rows are added to the view.
240
+
241
+
When a merge occurs, two things happen:
242
+
1. Segment deletes the **merge from** profile in the view, along with with all the traits that belong to it.
243
+
2. Segment updates the **merge to** profile with the traits from the **merge to** profile.
244
+
245
+
The `user_traits` table has the following columns:
|`canonical_segment_id`| The fully-merged Segment ID (the profile Segment now understands any events or identifiers to map to). |
276
+
|`type`| The type of external identifier sent in the incoming event, such as `user_id` or `anonymous_id`. External identifiers become the identities attached to a user profile. |
277
+
|`value`| The value of the trait provided by the customer's Identify payload. |
278
+
|`seq`| A sequential value derived from the timestamp. Enables ordering/sorting within a given unique trait. |
279
+
|`received_at`| The timestamp when the Segment API receives the payload from the client or server. |
280
+
|`uuid_ts`| A unique identifier of the timestamp. |
281
+
|`timestamp`| The UTC-converted timestamp set by the Segment library. |
282
+
283
+
### The profile_merges table
284
+
285
+
The `profile_merges` table contains all mappings from a `canonical_segment_id` to a `segment_id` to a profile which is represented by the `canonical_segment_id`.
286
+
287
+
With the profile_merges table:
288
+
- There's one row per profile associated with the `canonical_segment_id` that represents the profile. This view is a fixed schema.
289
+
- When a profile is created, a new row is created with the `segment_id` and `segment_canonical_id` having the same value.
290
+
291
+
292
+
When a merge occurs:
293
+
1. Segment deletes the **merge from** profile, along with all Segment IDs that belong to it.
294
+
2. Segment updates the **merge to** profile with Segment IDs that previously belonged to the **merge to** profile.
295
+
296
+
The `profile_merges` table has the following columns:
0 commit comments