Comparing two recipes to determine if one is different?

info-rchitect
info-rchitect Registered Posts: 173 ✭✭✭✭✭✭

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
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,914 Neuron
    edited July 17 Answer ✓

    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

Setup Info
    Tags
      Help me…