Define Project Variable through database table prior to execution of scenario

raviagrawal
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 ?

Answers

  • Mattsco
    Mattsco Dataiker, Registered Posts: 125 Dataiker
    edited July 18

    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)
Setup Info
    Tags
      Help me…