https://prefect.io logo
n

Newskooler

10/01/2020, 12:52 PM
Hi šŸ‘‹ Does anyone know how (if at all possible) to iterate over a
prefect.Paramter
? My question in more detail: https://stackoverflow.com/questions/64155793/is-it-possible-to-loop-over-a-prefect-parameter
i

itay livni

10/01/2020, 1:31 PM
Hi @Newskooler - look at mapping Also the input param name needs to be in quotes I.e ā€œurl_listā€
n

Newskooler

10/01/2020, 1:33 PM
Hi @itay livni I am not following what you are saying. Which mapping are you referring to? and by ā€œAlso the input param name needs to be in quotesĀ Ā I.e ā€œurl_listā€ are you saying I cannot past a list?
i

itay livni

10/01/2020, 1:37 PM
You can absolutely pass a list but your param name is &...&.... it should just be a string On my phone otherwise I’d give you an example A parameter in prefect is a special task So it needs a name
šŸ‘ 1
n

Newskooler

10/01/2020, 1:40 PM
Thanks I will dig in and try and see what you mean. So far I think I managed to achieve this by
.map()
which is quite handy.
i

itay livni

10/01/2020, 1:42 PM
And instead of ā€œfor_urlsā€ use get_url.map(list)
šŸ‘ 1
n

nicholas

10/01/2020, 1:50 PM
Hi @Newskooler -
.map
is definitely the way to go, you can use that over any iterable. The difference between what you've described in your SO post is you're trying to use normal looping over the Parameter (which, as @itay livni described is a special task). But using the special
.map
method will give you the results you're expecting and give you better insight into that process to boot.
šŸ‘ 1
n

Newskooler

10/01/2020, 1:51 PM
Thanks @nicholas whoever came up with
.map
and
unmapped
from the Prefect team, deserves a beer! šŸ»
n

nicholas

10/01/2020, 1:52 PM
They're quite useful huh?! šŸ˜„
n

Newskooler

10/01/2020, 1:53 PM
Yeah; very much so.