Define Project Variable through database table prior to execution of scenario
raviagrawal
Partner, Registered Posts: 18 Partner
Hi,
We have created a generic Dataiku Project which need the variable to be updated in each run. Instead of opening Dataiku project and changing the variable parameter or creating the multiple scenarios with different parameters, we want the parameters to be stored in a redshift table and want to change the parameter in table everytime when we want to run the Dataiku project. Is it possible to setup the project variable of scenario by any script or sql code in same format as required by Dataiku Project ?
We have created a generic Dataiku Project which need the variable to be updated in each run. Instead of opening Dataiku project and changing the variable parameter or creating the multiple scenarios with different parameters, we want the parameters to be stored in a redshift table and want to change the parameter in table everytime when we want to run the Dataiku project. Is it possible to setup the project variable of scenario by any script or sql code in same format as required by Dataiku Project ?
Answers
-
Hi,
You can use the following code to edit the variable from a python recipe:
import dataiku
client = dataiku.api_client()
project = client.get_project("PROJECTKEY")
variables = project.get_variables()
print(variables)
variables["standard"]["foo"] = "bar"
project.set_variables(variables)
print(variables)