JDBC Driver for HarperDB

Build 22.0.8462

FlattenArrays

Set FlattenArrays to the number of array elements you want to return as table columns. Otherwise, arrays are returned as strings of JSON.

Data Type

string

Default Value

"0"

Remarks

Without FlattenArrays set, arrays are returned as strings of JSON. The FlattenArrays property can be used to flatten array elements into columns of their own. This is only recommended for arrays that are expected to be short.

Set FlattenArrays to the maximum number of elements in an array that you want to return as columns. A zero-based index is concatenated onto the array name with a period separater to generate the column name. The original column for the array will also be returned. The column will contain the array as a JSON string (allowing you to further parse it if there are more elements than those flattened).

For example, consider the following primitive array example:

"interests": [ "code", "json", "data", "drivers" ]
When FlattenArrays is set to 3, the preceding array is flattened into the following table:

Column NameColumn Value
interests [ "code", "json", "data", "drivers" ]
interests.0code
interests.1json
interests.2data

See JSON Functions to use JSON paths to work with unbounded arrays.

For further examples of schema discovery and flattening arrays, please see Automatic Schema Discovery.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462