Hi everyone I am trying to use Parameter as an input to my flow. I want my parameter to be a dictionary. How can i access the dictionary? do i have to use dict(Parameter) to convert back to dict Type?
k
Kevin Kho
10/29/2021, 2:04 PM
How are you inputting it? Through the UI or through a default value during registration?
v
Vamsi Reddy
10/29/2021, 2:12 PM
i want to input it through the UI but also have a default dictionary
Vamsi Reddy
10/29/2021, 2:13 PM
ideally we want to call this flow through an api and pass the parameters
k
Kevin Kho
10/29/2021, 2:17 PM
I see it rendered right when submitted through the UI and the default
Kevin Kho
10/29/2021, 2:17 PM
My code:
Copy code
from prefect import task, Flow, Parameter
import prefect
@task
def abc(x):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(x)
<http://logger.info|logger.info>(type(x))
return x
with Flow("param_test") as flow:
test = Parameter("test", {"1":"a", "2":"b"})
abc(test)
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.