diff --git a/src/connections/storage/warehouses/schema.md b/src/connections/storage/warehouses/schema.md index 3d1a1a1538..560fd7029a 100644 --- a/src/connections/storage/warehouses/schema.md +++ b/src/connections/storage/warehouses/schema.md @@ -22,99 +22,79 @@ Segment's libraries pass nested objects and arrays into tracking calls as **prop - The warehouse connector optionally stringifies **arrays** when they follow the [Ecommerce spec](/docs/connections/spec/ecommerce/v2/) - The warehouse connector "flattens" all **context fields** that contain a nested **object** (for example, context.field.nestedA.nestedB becomes a column called context_field_nestedA_nestedB) - - - - - - - - - - - - - - - - - - - - +Segment flattens nested objects in traits. - - - - - - - - - - - -
Field Code (Example) Schema (Example)
Object (Context): Flatten - -``` json -context: { - app: { - version: "1.0.0" +### Schema objects + +The following examples show how Segment transforms nested objects and arrays into warehouse columns. + +#### Context + +**Type:** Object + +```json +{ + "context": { + "app": { + "version": "1.0.0" + } } } ``` - - Column Name:
- context_app_version -

- Value:
- "1.0.0" -
Object (Traits): Flatten + +Segment flattens nested objects in context fields. + +**Result:** Column `context_app_version` with value `"1.0.0"` + +#### Traits + +**Type:** Object ```json -traits: { - address: { - street: "6th Street" +{ + "traits": { + "address": { + "street": "6th Street" + } } } ``` - -Column Name:
-address_street
-
-Value:
-"6th Street" -
Object (Properties): Flatten +**Result:** Column `address_street` with value `"6th Street"` + +#### Properties + +**Type:** Object ```json -properties: { - product_id: { - sku: "G-32" +{ + "properties": { + "product_id": { + "sku": "G-32" + } } } ``` - - Column Name:
- product_id_sku

- Value:
- "G-32" -
Array (Any): Stringify + +Segment flattens nested objects in properties. + +**Result:** Column `product_id_sku` with value `"G-32"` + +#### Array (String) + +**Type**: String array ```json -products: { - product_id: [ - "507f1", "505bd" - ] +{ + "products": { + "product_id": ["507f1", "505bd"] + } } ``` - - Column Name:
- product_id

- Value: - "[507f1, 505bd]" -
+Segment stringifes arrays. + +**Result:** Column `product_id` with value `"[507f1, 505bd]"` ## Warehouse tables