Unpivot
    • Dark
      Light

    Unpivot

    • Dark
      Light

    Article Summary

    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

    PropertySettingDescription
    NameStringA human-readable name for the component.
    Columns to NarrowMultiple SelectSelect 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 NameStringAssign a name to the generated column that will be populated with the names from the columns in the column list.
    Output Values Column NameStringAssign a name to the generated column that will be populated with the values from the columns in the column list.

    Synapse Properties

    PropertySettingDescription
    NameStringA human-readable name for the component.
    Grouping ColumnsMultiple SelectSelect the columns to pass through.
    Unpivot Key NameStringSpecify the name of the unpivot column.
    Unpivot Value ColumnStringSpecify the name of the unpivot value column.
    Unpivot Source ListMultiple SelectSelect which source columns are to be un-pivoted.

    Delta Lake Properties

    PropertySettingDescription
    NameStringA human-readable name for the component.
    Columns to NarrowColumn SelectSelect 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 NameStringAssign a name to the generated column that will be populated with the names from the columns in the column list.
    Output Values Column NameStringAssign a name to the generated column that will be populated with the values from the columns in the column list.


    Video