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.