Use a cache sink with this lookup data of columns. Then you can use this in pattern match in a derive transform and remap the columns.
Dynamically change column names in ADF
Hi
How to dynamically change column names in Dataflow?
Suppose I get columns A,B,C from source and I want to change it Alpha, B, Comet.
Instead of selecting column A and C and then renaming, I want to do it by passing a string array for the input column names and a string array for the output column names. And then rename them.
['A','B','C'] and ['Alpha','B','Comet']
Is that possible?
Is it possible with hardcoding the positions of the names in the array?
Is it possible without hardcoding the positions of the names in the array?
regards
Ron
2 answers
Sort by: Most helpful
-
-
Poel van der, RE (Ron) 451 Reputation points
2021-06-14T07:55:13.433+00:00 hI @Kiran-MSFT
thnx for you answer.
Let me explain a little bit moreSuppose I have a JSON file with two separate arrays in it
Array1 = OldNames
Array2 = NewNamesThe arrays are used for renaming columns.
For instance Array1 might contain three names, like A, B and C.
Array2 might contain the names X1, Y1, Z1.
In the end my pipeline / dataflow must rename attribute A to X1, B to Y1 and C to Z1.
In a derived column activity you could work with the keyword ‘position’.But the issue is that each time another JSON file is input for this pipeline / data flow.
Array1 and Array2 always contain the same number of attributes, but one time it might be 5, the other 2 and another time 10 as an example
How then can we make this process dynamic, so that it will work regardless of the number of attributes in Array1 and Array2?regards
Ron