Examples
These are examples of import format configuration and how it affects the input data:
- KEY
- Enables you to specify which column is the primary key when several input CSV files are imported.
- KEEP
- Enables you to specify whether the key column must be a part of
the resulting JSON object.
These examples show the difference in KEEP usage:
Input Format Output "V6UJ9A03ARTD,true" "KEY 'accountId' KEEP 'activities' COL 'accountId' TEXT COL 'result' BOOL"; {"activities":[{"accountId":"V6UJ9A03ARTD","result":true}]} "V6UJ9A03ARTD,true" "KEY 'accountId' 'activities' COL 'accountId' TEXT COL 'result' BOOL"; {"activities":[{"result":true}]} - SCALAR
- Enables you to specify how to merge values. You must create an
array or overwrite a value. In the case of array creation, specify a name of the property.
In this example the name is 'activities'.
These examples show the difference in SCALAR usage:
Input Format Output "V6UJ9A03ARTD,true" "V6UJ9A03ARTD,false"
"KEY 'accountId' 'activities' COL 'accountId' TEXT COL 'result' BOOL"; {"activities":[{"result":true},{"result":false}]} "V6UJ9A03ARTD,true" "V6UJ9A03ARTD,false"
"KEY 'accountId' SCALAR COL 'accountId' TEXT COL 'result' BOOL"; {"result":false} - OPTIONAL and DEFAULT
- Enables you to specify whether the columns can remain empty and
whether the default value is used:
Input Format Output "V6UJ9A03ARTD,true" "V6UJ9A03ARTD,"
"KEY 'accountId' 'activities' COL 'accountId' TEXT COL 'result' OPTIONAL BOOL"; {"activities":[{"result":true},{}]}} "V6UJ9A03ARTD,true" "V6UJ9A03ARTD,"
"KEY 'accountId' 'activities' COL 'accountId' TEXT COL 'result' OPTIONAL DEFAULT ‘false’ BOOL"; {"activities":[{"result":true},{"result":false}]}