Setting default values for Array parameters/variables in Azure Data Factory

,

(2020-Aug-14) Setting default values for my parameters or variables in Azure Data Factory (ADF) may be a trivial task, but it gets more interesting when those elements are Arrays. The recent addition of Global Parameters to the Data Factory by Microsoft may create an extra thrill to learn how to set values for such parameters too: https://docs.microsoft.com/en-ca/azure/data-factory/author-global-parameters

Photo by Mihis Alex from Pexels

I had previously blogged about Arrays and how we can use them in ADF: http://datanrg.blogspot.com/2019/06/working-with-arrays-in-azure-data.html and this post is just a short memo to myself on how default array values can be prepared and used as well.


Array Parameters

A very simple, but a very straightforward way to set a default value for an array parameter is just to pass a text string that visually represents a collection of elements. In my example below I am setting the par_meal_array variable with the default value of '["Egg", "Greek Yogurt", "Coffee"]', which I can then further pass to my For Each Meal loop processing task as the list of items.


Array String converted into Array Variable 

In case if I have less flexibility to set a straightforward array default value, then I can start with a String parameter which can be converted into a collection of elements (array of elements). In my example below I am setting the par_meal_string variable with the default value of 'Egg,Greek Yogurt,Coffee', which I can then transform into variable array by using this function @split(pipeline().parameters.par_meal_string,',') in my Set Variable activity and further pass its output to my For Each Meal loop processing task as the list of items.


Configuring Pipeline Parameters in Triggers

With triggers in ADF, it can become more interesting when we can reuse the very same pipeline and configure its execution by different triggers while passing different input (default) parameters' values.


Let us create 3 triggers to cover a daily meal consumption and pass each individual trigger menu 🙂


Which now clearly can be done and very nutritious (or not) meals can be consumed. Obviously, you can see that this list of meals is just an analogy to something else, more applicable to your specific data factory development situation. Or you can just enjoy my writing and define your own carte du jour 🙂


Final thoughts

Actually, I don't any have any closing remarks for this post. In my consense, I think everybody already knows all about this and I'm not revealing anything significantly new. However, I've tested this all, I have finished writing the blog post about this, and I will remember this even better now 🙂 


Original post (opens in new tab)

Rate

Share

Share

Rate