Set a project level variable from a python recipe

Highlighted
tomas
Level 4
Set a project level variable from a python recipe
Jump to solution
Hi,

I need to set a project level variable from a python recipe. How can I do that? I dont want to use Scenario in this case.

Thanks for the example,

Tomas
0 Kudos
1 Solution

Accepted Solutions
Clément_Stenac Dataiker
Dataiker
Re: Set a project level variable from a python recipe
Jump to solution
Hi,

You need to use the public API Python client

dataiku.api_client().get_project().get_variables() ... then set_variables()

View solution in original post

2 Replies
Clément_Stenac Dataiker
Dataiker
Re: Set a project level variable from a python recipe
Jump to solution
Hi,

You need to use the public API Python client

dataiku.api_client().get_project().get_variables() ... then set_variables()

View solution in original post

tomas
Level 4
Re: Set a project level variable from a python recipe
Jump to solution
Thanks, actually it is a little bit more complicated, the sample code is:
import dataiku
v = dataiku.api_client().get_project('PROJECT_KEY').get_variables()
v['standard']['my_variable_name'] = 'value'
dataiku.api_client().get_project('PROJECT_KEY').set_variables(v)
0 Kudos
Labels (3)