Unpacks array data into separate rows for each value. This transform operates on a single column.

This transform does not reference keys in the array. If your array data contains keys, use the unnest transform. See Unnest Transform.

flatten col: myArray

Output: Generates a separate row for each value in the array. Values of other columns in generated rows are copied from the source. 

flatten: col: column_ref

TokenRequired?Data TypeDescription
flattenYtransformName of the transform
colYstringSource column name 


Identifies the column to which to apply the transform. You can specify only one column.

Required?Data Type
YesString (column name)

Example - Flatten an array

Example - Flatten and unnest together

While the above example nicely flattens out your data, there are two potential problems with the results:

The following example addresses both of these issues. It also demonstrates differences between the  unnest and the flatten transform, including how you use  unnest to flatten array data based on specified keys.