I need to set an automatic update of some date variables (the update is going to be recursive; each month it is going to add a month), which then will be used in a SQL receipts flow.
At the moment my solution is to create a date variable (dictionary containing the desired dates) and a Python script (inside a Python Notebook) that perform the update of the element of the dictionary, giving as output a dictionary of updated dates (formatted as unicode and so which can be used in the SQL receipt). I will then run the script and the SQL flow in a scenario, running each month.
The only thing I am missing is how to save back the dictionary into a project variable, inside the Python script.
Does such a function exist? Am I using a correct strategy?
Thank you very much for your help.
Assuming that you want to update the variable "stuff" in your project, use the following code:
import dataiku client = dataiku.api_client() project = client.get_project("MYPROJECT") variables = project.get_variables() variables["standard"]["stuff"] = "my new value for stuff variable" project.set_variables(variables)