saikoneru1997 / Azure_DataFactory

0 stars 0 forks source link

Dynamic column mapping #44

Closed saikoneru1997 closed 2 days ago

saikoneru1997 commented 2 days ago

First we need to declare the mapping for both source and sink in json format like below in table/file

"mappings": [ { "source": { "name": "deptid", "type": "String", "physicalType": "String" }, "sink": { "name": "dept_id", "type": "Int32", "physicalType": "int" }

this mapping can be put in table or json file while copying the data we can call this mapping dynamically

1.getmetadata activity to point to the folder where files are there

Image

2.foreach activity to loop the items within the folder

@activity('Get Metadata1').output.childItems

3.within the for each activity use lookup activity(already json is defined within the table then we are reading that json)

Image

select * from tbl_mappings where sourcefilename='@{item().name}'

Image

4.Now use copy activity pass filename and tablename dynamically by using lookup activity outputs

lookup activity output Image

5.copy activity pass the dynamic json for mapping

Image