def do(payload, config, plugin_config, inputs):
    for recipe_input in inputs:
        if recipe_input["role"] == "folder":
            folder = Folder(recipe_input["fullName"])
    paths = folder.list_paths_in_partition()
    choices = []
    for fileName in paths:
        if ".json" in fileName:
            jsonFile = folder.read_json(fileName)
            choices.append({"value": fileName,
                            "label": fileName + " (" + jsonFile["name"] + " | " + jsonFile["target"] + ")"})
    return {"choices": choices}
コード例 #2
0
def do(payload, config, plugin_config, inputs):
    folder = None
    for recipe_input in inputs:
        if recipe_input["role"] == "folder":
            folder = Folder(recipe_input["fullName"])
    if folder:
        paths = folder.list_paths_in_partition()
        choices = []
        for file_name in paths:
            if ".json" in file_name:
                choices.append({"value": file_name, "label": file_name})
        return {"choices": choices}
    else:
        return {
            "choices": [{
                "value": None,
                "label": "Invalid : no input folder"
            }]
        }
コード例 #3
0
def generate_path_list(folder: dataiku.Folder) -> List[AnyStr]:
    partition = ""
    if folder.read_partitions is not None:
        partition = folder.read_partitions[0]
    path_list = folder.list_paths_in_partition(partition)
    return path_list