Skip to content

Flatten Variant

'Flattens' (explodes) compound values into multiple rows. When an input column (of Variant type) contains many values, Flatten Variant can separate those values, giving each their own column.


Properties

Name = string

A human-readable name for the component.


Column Mapping = column editor

Choose an input column and a property from it to take. Each property taken creates a column in the output and each row contains values from each property from its respective row in the input data.


Column Flattens = column editor

Take a property from an input column and flatten it such that its values constitute another input column. For example, an array value held as a single string in an input column can be flattened, so long as it adheres to the formatting outlined at the top of this article. Columns defined here can be used in the 'Column Mapping' property.


Strategy

For this component to be useful, the input data must be condensed in such a way that a single column contains multiple columns worth of data. The expected format is as follows:

{ "<ColumnName>": "<Value>", "<ColumnName2>": "<Value>", ... }

For example:

{ "Name": "John Bigs", "Age": 32, "Married": TRUE }

In the example above, this single column can be separated into 3 columns named 'Name', 'Age' and 'Married' with respective types VARCHAR, NUMBER, BOOLEAN.

This component can be used to flatten nested arrays and expose their variables. For a guide on how this works, see the Flattening Nested Arrays page.


Video


Snowflake Delta Lake on Databricks Amazon Redshift Google BigQuery Azure Synapse Analytics