Python Recipe - Get name of current recipe, inputs, and outputs (DSS 8)

sylvyr3
sylvyr3 Registered Posts: 21 ✭✭✭✭
edited July 16 in Using Dataiku

I'm trying to write a python recipe that that calls a function from an internal module but I need to be able to pass the name of the input and output table for that recipe. Since the user can specify any name for the output table I need to be able to grab it programmatically.

It seems like it's fairly easy in DSS 9 - https://community.dataiku.com/t5/Using-Dataiku-DSS/Python-recipe-iterate-through-inputs/td-p/17071

In DSS 8 it looks like I might need to pass the name of the current recipe to (https://doc.dataiku.com/dss/latest/python-api/recipes.html#listing-recipes)

project.get_recipe("myrecipe")

retrieve the names of the inputs and outputs. But it seems like the default recipe naming convention is "compute_"+output_dataset_name. So I'm back to the problem of not knowing what the recipe name is without an api call of some sort.

Tagged:

Best Answer

  • fchataigner2
    fchataigner2 Dataiker Posts: 355 Dataiker
    Answer ✓

    Hi,

    if your recipe is not partitioned, then you can get its name by taking the activity id and removing the _NP end

    from dataiku.core.flow import FLOW
    current_recipe_name = FLOW["currentActivityId"][:-3]

Setup Info
    Tags
      Help me…