Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
I was wondering, is there a way to create scenarios, similar to the following way of recipe creation? The main requirement is to be able to create code scenarios, not step-based ones.
builder = project.new_recipe("python") # Set the input builder.with_input("myinputdataset") # Create a new managed dataset for the output in the filesystem_managed connection builder.with_new_output_dataset("grouped_dataset", "filesystem_managed") # Set the code - builder is a PythonRecipeCreator, and has a ``with_script`` method builder.with_script(""" import dataiku from dataiku import recipe input_dataset = recipe.get_inputs_as_datasets() output_dataset = recipe.get_outputs_as_datasets() df = input_dataset.get_dataframe() df = df.groupby("something").count() output_dataset.write_with_schema(df) """) recipe = builder.create()
Yes, we have some helpful examples in the following knowledge base document: https://doc.dataiku.com/dss/latest/scenarios/custom_scenarios.html#examples
Please let us know if you have any questions.
Thanks for the answer, however, I haven't found any example of creating a scenario object similar to how it might be done with recipes in the sample I sent above. Perhaps you could still help me with that? My aim is to do smth like
#pseudo-code builder = project.new_scenario("new_scenario") # Set the code - builder is a PythonRecipeCreator, and has a ``with_script`` method builder.with_script(""" def func(x, y): return x + y """) recipe = builder.create()