Submit your innovative use case or inspiring success story to the 2023 Dataiku Frontrunner Awards! LET'S GO

Run a recipe for all partitions available

nshapir2
Level 1
Run a recipe for all partitions available

When I run a recipe how do I run it for all the partitions of one variable.

 

In the below photo I would like to run this code recipe for all partitions in RW_Index.

0 Kudos
1 Reply
AlexT
Dataiker

Hi,

Currently DSS expects the explicit list of partitions to build. If you want run a recipe on all partitions you can use scenario with execute python code.  Here is one example of how you could accomplish this:

from dataiku.scenario import Scenario
import dataiku

scenario = Scenario()
dataset = dataiku.Dataset("input_dataset_name")

partitions = dataset.list_partitions() # get all partitions from input dataset

# for all available partitions in all dimensions 
#partitions_str = ','.join(partitions) # concatenate 

#when some dimensions are defined but another dimensions requires ALL include in your example partitions you want will start with '2020Q4|Pricing|L4L_Monthly'
partitions_str = ','.join([item for item in partitions if item.startswith('2020Q4|Pricing|L4L_Monthly')])

scenario.build_dataset("output_good", partitions=partitions_str)