Dynamically reordering columns in mapping data flow without using Fixed mapping

Kunal sharma 0 Reputation points
2023-09-18T20:42:33.17+00:00

I want to reorder column names based on an array input parameter within Data Flow

Example -

Actual Order of columns - id, firstname, address, phoneNumber

Order Needed - id, address, phoneNumber, firstname

I use a parameterized Array to state expected order - ["id","address","phoneNumber","firstname"]

I want to re-arrange columns based on this Array on the fly dynamically without using Fixed Mappings in Data Flow.

Can i achieve this using Select or Derived Column? Or is this impossible? I went through many Q&A similar to it and didn't got much around this.

Help!

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,863 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,575 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Subashri Vasudevan 11,206 Reputation points
    2023-09-19T10:36:18.7966667+00:00

    Hi Kunal sharma

    You can use select transformation. Please see if below screenshots help.

    My source file schema

    Screenshot 2023-09-19 at 4.36.12 PM

    My data flow parameter settings:

    Screenshot 2023-09-19 at 4.37.35 PM

    As you can see, i have changed order of columns in array.

    Next, Select statement settings:

    Screenshot 2023-09-19 at 4.38.21 PM

    Now, looking at the preview of sink:

    Screenshot 2023-09-19 at 4.40.20 PM

    Hope it helps. Please try and let us know.

    Thanks


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.