Hi everyone I am trying to use Parameter as an inp...
# ask-community
v
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
How are you inputting it? Through the UI or through a default value during registration?
v
i want to input it through the UI but also have a default dictionary
ideally we want to call this flow through an api and pass the parameters
k
I see it rendered right when submitted through the UI and the default
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)
I also tried passing through the UI
v
Thank you very much kevin