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
You configure normalization with a `nest` block in the child entities' RDI job, as shown in this example:
38
+
39
+
When configuring normalization first you need to configure the parent entity to use JSON as the target data type. Add `data_type: json` to the parent job. Example:
40
+
41
+
```yaml
42
+
# jobs/invoice.yaml
43
+
source:
44
+
server_name: chinook
45
+
schema: public
46
+
table: Invoice
47
+
48
+
output:
49
+
- uses: redis.write
50
+
with:
51
+
# Setting the data type to json ensures that the parent object will be created in a way that supports nesting.
52
+
data_type: json
53
+
# Important: do not set a custom key for the parent entity.
54
+
# When nesting the child object under the parent, the parent key is automatically calculated based on
55
+
# the parent table name and the parent key field and if a custom key is set, it will cause a mismatch
56
+
# between the key used to write the parent and the key used to write the child.
57
+
58
+
```
59
+
60
+
After that parent model is configured, it is time to configure the child entities. To do that use the `nest` block, as shown in this example:
39
61
40
62
```yaml
63
+
# jobs/invoice_line.yaml
41
64
source:
42
65
server_name: chinook
43
66
schema: public
@@ -52,6 +75,7 @@ output:
52
75
table: Invoice
53
76
nesting_key: InvoiceLineId # cannot be composite
54
77
parent_key: InvoiceId # cannot be composite
78
+
child_key: InvoiceId # optional, if different from parent_key
55
79
path: $.InvoiceLineItems # path must start from document root ($)
56
80
structure: map # only map supported for now
57
81
on_update: merge # only merge supported for now
@@ -111,3 +135,4 @@ There are several important things to note when you use nesting:
0 commit comments