Working with Project variables

Options
nitinrsharma
nitinrsharma Registered Posts: 1 ✭✭✭

Hi ,

We are working with access global variables and using that to do some operation and want to write it back to local variables of the project but keep the global variable untouched. set_variables do not have option to differentiate between global and local and thus creating an issue by overwriting both and messing up the json structure, same for update variables. Do we have a elegant solution to this ?

Tagged:

Answers

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,209 Dataiker
    Options

    Hi,

    You should be able to set global project variables ( standard) and local project variables.

    Please see the below sample :

    import dataikuproject = dataiku.api_client().get_project(dataiku.default_project_key())vars = project.get_variables()#set global variablesvars['standard']['variable_name'] = "global_variable"#set local variablesvars['local']['variable_name'] = "local_variables"project.set_variables(vars)

    Thanks

Setup Info
    Tags
      Help me…