Dynamic Global variables in DSS
ele_f
Registered Posts: 17 ✭✭✭✭
Hi,
I wanted to ask if in DSS it is possible to define some global variables at workflow level that can be called in different recipes in different points in the flow.
For example, set @SomeVariable = 'VALUE' and then use SomeVariable in the flow in my recipe.
It would be an extremely useful feature! E.g. If I wanted to run the workflow first for product = Y and then product = X, I could define a product variable. Or if I wanted to run my flow for timestamp < DATE I could define the variable DATE = %mydate% and change this as I like.
Thanks!
I wanted to ask if in DSS it is possible to define some global variables at workflow level that can be called in different recipes in different points in the flow.
For example, set @SomeVariable = 'VALUE' and then use SomeVariable in the flow in my recipe.
It would be an extremely useful feature! E.g. If I wanted to run the workflow first for product = Y and then product = X, I could define a product variable. Or if I wanted to run my flow for timestamp < DATE I could define the variable DATE = %mydate% and change this as I like.
Thanks!
Answers
-
Hi,
This is possible. It's usable mostly in code recipes, and also in formulas in visual recipes;
Please see https://doc.dataiku.com/dss/latest/advanced/variables_expansion.html -
Thanks! Can it be used in recipe like Group_by and Prepare?
-
Prepare recipe: yes using a Formula processor and the "${variable_name}" syntax (make sure to put " quotes around the ${}).
Group recipe: yes using Formulas in Prefilter / Computed Columns / Postfilter if you run the recipe with the DSS or Spark engine. For SQL engine, you may want to convert the recipe to SQL and then do your variable manipulation there.