Importing data to recipe.json

vishet
Level 3
Importing data to recipe.json

Hi,

I was curious if we can import data from a recipe in recipe.json.

Use case: there is a list of filenames that are generated and the user is supposed to pick among these filenames which will be in turn used in a recipe. 

Basically, importing a list of filenames in recipe.json that the user interacts with and then based on this interaction, the recipe takes this as input and processes it forward.

If there is a way of doing this, how do I proceed?

0 Kudos
3 Replies
Marlan

Hi @vishet

Your need might be met by the Applications feature was introduced in version 8. Basically you can create a UI for a project and package it up so users can interact with it. The Knowledge Base has a good tutorial: https://knowledge.dataiku.com/latest/kb/o16n/dataiku-applications/index.html. I'd think the Visual Applications option is the one you'd want.

A macro plugin would be a more light weight option but you have to code the logic in Python in the macro rather than in recipe. But if you want to allow the user to choose from options and then do something and either show the results or write the results somewhere, it works nicely. But executing it requires going to the Macro menu and selecting it.

Marlan

0 Kudos
vishet
Level 3
Author

Thanks for your response.

If I understand correctly my requirements consist of 2 parts. Also, this will be a potential component to a plugin

1. Get data from a dataset and display them in the json part of the macro-plugin. Next to each entry, there will be a checkbox which is the user selecting which document details are required.(How do I implement this?)

2. Once I implement the checkbox, is there a way for me to get only the values that are only checked?

Any working example on this would be very beneficial

0 Kudos
Marlan

Hi @vishet,

I haven't done what you are wanting to do so not sure much more help I can be. But here are some ideas and references.

For allowing the user to select from the choices, you are probably going to to want to use the MULTISELECT type of input in the macro plugin. You'd also set getChoicesFromPython to true and define a Python script that pulls the options from the dataset.

Here is an example that uses a Python function to populate choices: https://github.com/dataiku/dataiku-contrib/tree/master/clear-intermediate-datasets/python-runnables/...

You can see how the choices are accessed within the Python part of the plugin as well.

There might be others in the Dataiku github that would be helpful examples to review.

Marlan 

 

0 Kudos