Unpivot
  • Dark
    Light

Unpivot

  • Dark
    Light

This article is specific to the following platforms - Snowflake - Synapse.

Unpivot Component

The Unpivot component rotates a table by transforming columns into rows.

UNPIVOT is a relational Snowflake operator that accepts two columns (from a table), along with a list of columns, and generates a row for each column specified in the list. In a query, it is specified in the FROM clause after the table name.

For more information, see the Microsoft documentation.

This operator can be used to transform a wide table (e.g. jan_sales, feb_sales, mar_sales) into a narrower table (e.g. month, sales).

Note: The Unpivot component is not a direct reverse of the Pivot component, since UNPIVOT cannot undo aggregations made by PIVOT.


This component is only available for Matillion ETL for Delta Lake on Databricks instances on AWS (not Azure).

Properties

Snowflake Properties

Property Setting Description
Name String A human-readable name for the component.
Columns to Narrow Multiple Select Select the columns in the source table to narrow into a single pivot column. The column names will populate name_column, and the column values will populate value_column.
Output Names Column Name String Assign a name to the generated column that will be populated with the names from the columns in the column list.
Output Values Column Name String Assign a name to the generated column that will be populated with the values from the columns in the column list.

Synapse Properties

Property Setting Description
Name String A human-readable name for the component.
Grouping Columns Multiple Select Select the columns to pass through.
Unpivot Key Name String Specify the name of the unpivot column.
Unpivot Value Column String Specify the name of the unpivot value column.
Unpivot Source List Multiple Select Select which source columns are to be un-pivoted.

Delta Lake Properties

Property Setting Description
Name String A human-readable name for the component.
Columns to Narrow Column Select Select the columns in the source table to narrow into a single pivot column. The column names will populate name_column, and the column values will populate value_column.
Output Names Column Name String Assign a name to the generated column that will be populated with the names from the columns in the column list.
Output Values Column Name String Assign a name to the generated column that will be populated with the values from the columns in the column list.


Video