Comparing two recipes to determine if one is different?
Hi,
We create Dataiku project templates which give the user known-good recipes and flow zones to accomplish a certain task. The project has variables we use in the recipes to parameterize the usage such that it can be run using different settings. My question is if there is a way I could loop through the recipes in the users' project and get a boolean result if a recipe has been edited in any way.
Perhaps, there is some recipe text definition I could create a hash ID I could use to do the boolean diff?
thx
Operating system used: Windows 10
Best Answer
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,088 Neuron
The power of the Dataiku API! Here you go:
import dataiku client_handle = dataiku.api_client() project_handle = client_handle.get_project('some project key') # Or you use client_handle.list_project_keys() # to get all project keys python_recipes = [i for i in project_handle.list_recipes() if i['type'] in ['python']] for python_recipe in python_recipes: recipe_name = python_recipe['name'] recipe_handle = project_handle.get_recipe(recipe_name) recipe_script = recipe_handle.get_settings().get_payload() # Do something with it
Answers
-
@Turribeach
What do you think of a native recipe boolean comparison function between two recipes? -
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,088 Neuron
Too niche to be a built-in feature. But you have the API so you leverage that. You can also use the recipe modified date compared to the creation date to see if the recipe was changed.