Difference between global Variable and local variable

Options
hungtechnguyen
hungtechnguyen Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1 ✭✭✭

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?

Answers

  • tgb417
    tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,595 Neuron
    Options

    @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.

  • Marlan
    Marlan Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant, Neuron 2023 Posts: 317 Neuron
    Options

    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-variables/idi-p/12894

    Marlan

Setup Info
    Tags
      Help me…