Hi :wave: Does anyone know how (if at all possible...
# ask-community
n
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
Hi @Newskooler - look at mapping Also the input param name needs to be in quotes I.e ā€œurl_listā€
n
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
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
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
And instead of ā€œfor_urlsā€ use get_url.map(list)
šŸ‘ 1
n
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
Thanks @nicholas whoever came up with
.map
and
unmapped
from the Prefect team, deserves a beer! šŸ»
n
They're quite useful huh?! šŸ˜„
n
Yeah; very much so.