Difference between global Variable and local variable

hungtechnguyen
Level 1
Difference between global Variable and local variable

I want to clarify the difference between Global and Local Variables. I told them the definition from here 

So, then what's the point of having Local Variables if in Production I'm just going to use global Variables only. Isn't Local Variable redundant to have?

0 Kudos
2 Replies
tgb417

@hungtechnguyen 

My understanding is that this topic comes into play when you are ready to put projects into production.

From the documentation I see the following comment:

Note

The project variables page has a section for global variables and local variables. While the variables that are defined in both sections are project-specific, those that are defined in the โ€œlocal variablesโ€ section are also instance-specific. Therefore, local variables are not exported when you bundle a project for the purpose of deploying it from the design node to the automation node.

You can also visit the product documentation for more details.

As I understand this gives you the ability to scope your variables by the host you are environment in which your project is running.  

 

--Tom
0 Kudos
Marlan

Hi @hungtechnguyen,

To add to @tgb417's explanation, here's an example of how I have used local variables.  

In production I may want to notify customers if a scenario fails but in development I only want to notify myself. So I create a "global" variable that includes all of the email addresses of the customers and then I create a local variable of the same name that just includes my email address. On the development instance the local variable overrides the global variables and only I get the emails. When the project is moved to the production instance, only the global variables are included. Thus emails go all customers automatically. 

If you'd like to see the documentation on variables clarified, consider "liking" this idea:

https://community.dataiku.com/t5/Product-Ideas/Expand-clarify-documentation-and-UI-references-to-var...

Marlan