azure-data-factorydelta

How to process a Database Delta sql file in Azure Data Factory to update a MySQL database


I have an .sql delta file that contains updates and deletions to a database tables. I have a database that contains the same tables that the delta is made for to update. Within Azure Data Factory what is the approach to achieve updating my database with this delta?

Delta is stored in Azure Blob Storage I have a linked service with connection to my MySQL database.

The delta contains sql statements like Insert, Delete From etc...


Solution

  • To process .sql file in ADF you can use lookup to get the queries from file as below set row and column delimiter as ;.

    enter image description here

    Lookup Output: enter image description here

    Now to execute them in MySQL take foreach loop to pass each query to lookup under it. enter image description here

    In lookup attach MySQL liked service and query with expression @concat(item().Prop_0,'; select 1 as demo;')

    enter image description here