Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi,
For updating global variables, you need to use Dataiku Public API. See example below:
import dataiku
client = dataiku.api_client()
global_variables = client.get_variables()
print(global_variables)
global_variables["foo"] = "bar"
client.set_variables(global_variables)
print(global_variables)
The full documentation is located here for your reference: https://doc.dataiku.com/dss/latest/python-api/rest-api-client/client.html#dataikuapi.dssclient.DSSClient.get_variables
[EDIT] The answer above only works if your user has an ADMIN role on Dataiku. Otherwise, you can use the following code to edit the variable of one project from another:
import dataiku
client = dataiku.api_client()
project = client.get_project("TSFORECAST")
my_other_project_variables = project.get_variables()
print(my_other_project_variables)
my_other_project_variables["standard"]["foo"] = "bar"
project.set_variables(my_other_project_variables)
print(my_other_project_variables)
Hope it helps,
Alex