Christian Eik
03/26/2021, 6:06 PMwith Flow('fiege_po_uploads', schedule=cron_schedule) as fiege_po_uploads:
po_nos_query = build_po_nos_query.map(brand=brands)
po_nos = snowflake_queryfetch.map(
query=po_nos_query, upstream_tasks=[po_nos_query])
po_query = build_po_data_query.map(
po_no=po_nos, brand=brands, upstream_tasks=[po_nos])
brands is a list of 2 strings. in the third task I'm trying to use 2 mapped arguments and i can kinda understand that this doesn't really work. however what is the proper way to do something like this? i'm a complete beginner to both prefect and anything functional, so i probably have a conceptual misunderstanding here. essentially what i'm trying to do here is having an outside loop over brands, an inside loop over po_nos , and be able to use the value of brands in every inner iteration.Kevin Kho
Kevin Kho
Flatten part of the docs? This might help think through this https://docs.prefect.io/core/concepts/mapping.html#flat-mappingChristian Eik
03/26/2021, 7:31 PMbrand. i ended up just making a copy of the flow and hardcoding the brand in both, but that doesn't feel right 😅Christian Eik
03/26/2021, 7:32 PMKevin Kho
Christian Eik
03/26/2021, 7:38 PMsnowflake_queryfetch = SnowflakeExecuteFetch(
account='asd',
user='prefect',
password=Secret("PREFECT_SNOWFLAKE_PW").get(),
role='prefect',
warehouse='prefect'
)Christian Eik
03/26/2021, 7:39 PMSnowflakeExecuteFetch is a modified version of the built in snowflake tasks, just swapped a few lines to execute and fetchallKevin Kho
Christian Eik
03/26/2021, 7:41 PMKevin Kho
Kevin Kho
Christian Eik
03/29/2021, 12:29 PMpo_nos is the same for every value of brand, which in my case is unfortunately not the case. e.g. on any given run i might get [1, 2] for brand a and [4, 6, 8] for brand b.Christian Eik
03/29/2021, 12:32 PMbrand would always be returned by every task along with the actual result of the task. that worked, but also didn't really feel right.Christian Eik
03/29/2021, 12:36 PMbrand. e.g. if there was a way to register the flow once per value of brand, that would also work. didn't really find anything about that though.Kevin Kho
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by