Inline Augmentation: JSON Field Generation

Instead of mapping a JSON field directly to a relational column, a JSON-relational duality view can generate the field. Generated fields and fields mapped to columns can be hidden , that is, not shown in documents supported by the view.

The computation of a generated field value can use the values of other fields defined by the duality view, including other generated fields, whether those fields are hidden or are present in the supported documents.

For example, this code defines (nonhidden) field points of a racing-team document as being generated by a path expression that sums the points fields of the team’s drivers1:

points @generated (path : "$.driver.points.sum()")

Read and write document augmentation differ:

When document augmentation (read or write) is defined inline , in the sense that the definition of the augmentation is part of the duality-view definition/creation code (DDL), we speak of inline augmentation , the subject of this chapter.

For inline read augmentation, a duality view can generate a field using using a SQL/JSON path expression (as shown above), a SQL expression, or a SQL query. For inline write augmenation, it can only use a path expression to generate a field.


  1. See Example 8-2 for the full team duality-view definition.