How to change a project global variable that is used in python recipe through a scenario?

Akshay23
Level 1
How to change a project global variable that is used in python recipe through a scenario?

I have defined a project global variable, xcoord -

{
"xcoord": 300
}

I am using this variable in a python recipe though x2 as defined. This python recipe is used to build a downstream dataset and is working fine.

client = dataiku.api_client()
projectKey = dataiku.default_project_key()
proj = client.get_project(projectKey)
projVars = proj.get_variables()['local']
x2 = projVars['xcoord']

However, I want to update dataset through scenario using set project variables and Build dataset step. When i run the scenario, DSS is not updating the downstream dataset. How can I achieve this in Scenario?

Thank you.

 

0 Kudos
2 Replies
CatalinaS
Dataiker

Hi @Akshay23,

If I understand correctly, your dataset is not updated with new values after you changed the variable and run the flow again.The new values are not updated most probably because the dataset is build only if the dataset is uninitialized. The build doesn't run again if the data is available. It can re-run again only if data is cleared. Therefore the solution would be to add a step in the scenario that clears the dataset before building it. This will force the rebuild of the dataset and it should update with new values.

Let me know if this helps.

0 Kudos
Akshay23
Level 1
Author

Hi @CatalinaS,

Thank you for the reply. Actually the issue got resolved later on. The issue was something related to update of python recipe. The scenario was somehow not using the updated python recipe.

 

0 Kudos