Hi, a basic question – what’s the recommended way ...
# ask-community
k
Hi, a basic question – what’s the recommended way to loop parameters if .map() doesn’t work with function of multiple outputs?  I have a pipeline like this
Copy code
def pipe(dt):
    #get intermediary output
	output1, output2, output3 = step1(dt)
    #write to database
	step2(output1, output2, output3)
is it like this or is there a better way?
Copy code
with Flow('multi-output func') as flow:
    dt = Parameter("urls", default=['dt1', 'dt2', 'dt3'])
    for dt in dt_range:
        pipe(dt)
thank you
k
So the reason it doesn’t work is that a map operation with multiple outputs returns a type of
List[Tuple]
while using it for mapping requires a structure like
Tuple[List]
so you need to reshape the outputs with an intermediate task
k
thank you so much for your reply! if the multiple outputs are nested dictionaries with different format and length, probably better to not use .map() with intermediate task?
k
I think that sounds like a use case for flatten? Not sure though
🙏 1