Modify the value of a variable in a Python recipe

bored_panda
Level 2
Modify the value of a variable in a Python recipe

Hello,



I'm asking this question again, because I need an answer quickly and I'm not sure my comment in the original thread will be seen.



"I would like to modify the value of a variable that I declared in my project (Settings > Variables) in a Python recipe. Is it possible ?"



Thanks.

0 Kudos
2 Replies
AdrienL
Dataiker

The DSS public API allows you to do that, including via its python client: see DSSProject.set_variable. You'll need to install the python package in the DSS Python environment though.



Depending on the use case, you may find it simpler to use a Set project settings step in a Scenario, even if you have a custom python step before to compute the value.

0 Kudos
tomas
Level 5
I would appreciate an example rather than a link to a documentation, where it is quite hard to navigate and search.
0 Kudos