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/connections/storage/warehouses/schema.md
+53-73Lines changed: 53 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,99 +22,79 @@ Segment's libraries pass nested objects and arrays into tracking calls as **prop
22
22
- The warehouse connector optionally stringifies **arrays** when they follow the [Ecommerce spec](/docs/connections/spec/ecommerce/v2/)
23
23
- 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)
24
24
25
-
<table>
26
-
<thead>
27
-
<tr>
28
-
<th> Field </th>
29
-
<th> Code (Example) </th>
30
-
<th> Schema (Example) </th>
31
-
</tr>
32
-
</thead>
33
-
34
-
<tr>
35
-
<td><b>Object (Context):</b> Flatten </td>
36
-
<tdmarkdown="1">
37
-
38
-
```json
39
-
context: {
40
-
app: {
41
-
version: "1.0.0"
25
+
### Schema objects
26
+
27
+
The following examples show how Segment transforms nested objects and arrays into warehouse columns.
28
+
29
+
#### Context
30
+
31
+
**Type:** Object
32
+
33
+
```json
34
+
{
35
+
"context": {
36
+
"app": {
37
+
"version": "1.0.0"
38
+
}
42
39
}
43
40
}
44
41
```
45
-
</td>
46
-
<td>
47
-
<b>Column Name:</b><br/>
48
-
context_app_version
49
-
<br/><br/>
50
-
<b>Value:</b><br/>
51
-
"1.0.0"
52
-
</td>
53
-
</tr>
54
-
55
-
<tr>
56
-
<td> <b>Object (Traits):</b> Flatten </td>
57
-
<td markdown= "1">
42
+
43
+
Segment flattens nested objects in context fields.
44
+
45
+
**Result:** Column `context_app_version` with value `"1.0.0"`
46
+
47
+
#### Traits
48
+
49
+
**Type:** Object
58
50
59
51
```json
60
-
traits: {
61
-
address: {
62
-
street: "6th Street"
52
+
{
53
+
"traits": {
54
+
"address": {
55
+
"street": "6th Street"
56
+
}
63
57
}
64
58
}
65
59
```
66
60
67
-
</td>
68
-
<td>
69
-
<b>Column Name:</b><br/>
70
-
address_street<br/>
71
-
<br/>
72
-
<b>Value:</b><br/>
73
-
"6th Street"
74
-
</td>
75
-
</tr>
61
+
Segment flattens nested objects in traits.
76
62
77
-
<tr>
78
-
<td><b>Object (Properties):</b> Flatten</td>
79
-
<tdmarkdown="1">
63
+
**Result:** Column `address_street` with value `"6th Street"`
64
+
65
+
#### Properties
66
+
67
+
**Type:** Object
80
68
81
69
```json
82
-
properties: {
83
-
product_id: {
84
-
sku: "G-32"
70
+
{
71
+
"properties": {
72
+
"product_id": {
73
+
"sku": "G-32"
74
+
}
85
75
}
86
76
}
87
77
```
88
-
</td>
89
-
<td>
90
-
<b>Column Name:</b><br/>
91
-
product_id_sku<br/><br/>
92
-
<b>Value:</b><br/>
93
-
"G-32"
94
-
</td>
95
-
</tr>
96
-
97
-
<tr>
98
-
<td><b>Array (Any):</b> Stringify</td>
99
-
<tdmarkdown="1">
78
+
79
+
Segment flattens nested objects in properties.
80
+
81
+
**Result:** Column `product_id_sku` with value `"G-32"`
82
+
83
+
#### Array (String)
84
+
85
+
**Type**: String array
100
86
101
87
```json
102
-
products: {
103
-
product_id: [
104
-
"507f1", "505bd"
105
-
]
88
+
{
89
+
"products": {
90
+
"product_id": ["507f1", "505bd"]
91
+
}
106
92
}
107
93
```
108
94
109
-
</td>
110
-
<td>
111
-
<b>Column Name:</b> <br/>
112
-
product_id <br/><br/>
113
-
<b>Value:</b>
114
-
"[507f1, 505bd]"
115
-
</td>
116
-
</tr>
117
-
</table>
95
+
Segment stringifes arrays.
96
+
97
+
**Result:** Column `product_id` with value `"[507f1, 505bd]"`
0 commit comments