Skip to content
Advertisement

Python Azure Data Factory Update Pipeline

I want to use Python to add an activity to a pipeline in Azure Data Factory. With the following code I am replacing the actual activity but not adding a new one:

JavaScript

This is the pipeline before running the code : enter image description here

After running the code:

enter image description here

Expected :

enter image description here

Advertisement

Answer

Researched the statements in source code:

enter image description here

So when you update the pipeline, the activities property should be the list of activities in pipeline, not single one.

For example:

JavaScript

Please note two lines:

JavaScript

This property should contains all of your activities.

JavaScript

This is the dependency conditions between your activities.

My output:

enter image description here

Any concern, please let me know.


Well,please see my sample code:

The premise is that I already have the above two wait activities

JavaScript

Then output is :

JavaScript

Then you could see the objects in above activities property. Besides,you could see their types: 'activities': [<azure.mgmt.datafactory.models.wait_activity_py3.WaitActivity object at 0x000001C05FEDE0F0>, <azure.mgmt.datafactory.models.wait_activity_py3.WaitActivity object at 0x000001C05FED6DA0>]

They are WaitActivity type, so you could view their loop the activity to get every item in it using :

JavaScript

You could view what properties the WaitActivity type contains, likename,type in source code statements.(For me, i used Pycharm to test code,the IDE could detect source code directly)

enter image description here

Then if you want to add one more activity,for example, one more WaitActivity:

JavaScript

Please see above code, i created a new WaitActivity named wait_activity2 ,then append it into activities array. Then update the pipeline as normal, you will find the new activity :

enter image description here

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement