In this blog we are going to learn how to implement Dynamic Mapping to copy data from multiple sources to sinks in ADF.
The below attached images show that there are 2 pair of source-destination tables. Now the source table is holding some data while the destination tables is blank, but its schema is similar to its respective source table. [Refer below images]
Now our requirement is to copy data from all the source tables to their respective destination tables in ADF. To fulfil this requirement, we usually create a copy data activity and pass the source & destination datasets – which basically copies the data from source to destination. But now let’s say there are 10 source & 10 destination datasets, one needs to create the Copy Data Activity 10 times & pass the respective source & destination. This approach is inherently redundant and repetitive in nature. We could resolve this by making it dynamic.
Making Copy Data Dynamic
To make copy data dynamic we need to create a JSON with source and destination tables, this is the required format & based on this JSON we shall copy data from multiple source to their respective destination using a single Copy Data Activity
[ { "copyActivity": { "translator": { "mappings": [ { "sink": { "name": "id", "type": "Int32" }, "source": { "name": "id", "type": "Int32" } }, { "sink": { "name": "name", "type": "String" }, "source": { "name": "name", "type": "String" } }, { "sink": { "name": "subject", "type": "String" }, "source": { "name": "subject", "type": "String" } } ], "type": "TabularTranslator" } }, "destination": { "tableName": "destination01" }, "source": { "tableName": "source01" } }, { "copyActivity": { "translator": { "mappings": [ { "sink": { "name": "SourceID", "type": "Int32" }, "source": { "name": "SourceID", "type": "Int32" } }, { "sink": { "name": "Source", "type": "String" }, "source": { "name": "Source", "type": "String" } } ], "type": "TabularTranslator" } }, "destination": { "tableName": "Destination02" }, "source": { "tableName": "Source02" } } ]
Once the JSON is created, we need to follow the below mentioned steps to dynamically copy data from multiple sources to their appropriate destinations:
And inside the Sink section, select the source dataset to ‘ds_destination’ & pass the dataset parameter to “@item().destination.tableName”.
[This will be pointing to the destination tables mentioned in the JSON content]
In this way we can copy data from multiple sources to multiple sinks in ADF dynamically using a single ‘Copy Data Activity’.
ATM Inspection PowerApp to ease ATM inspection and report generation process.
https://www.inkeysolutions.com/microsoft-power-platform/power-app/atm-inspection
Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/drag-and-drop-listbox
Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.
https://www.inkeysolutions.com/microsoft-dynamics-365/dynamicscrmaddons/gdpr
Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/view-creator
© All Rights Reserved. Inkey IT Solutions Pvt. Ltd. 2024
Leave a Reply