Justin Burchard
04/21/2022, 7:25 PMKevin Kho
04/21/2022, 7:35 PMwith Flow('parent') as flow:
create_flow_run(flow_name=.., project_name=..., parameters={'env': "DEV"})
and then in the child flow:
@task
def get_secret_name(env):
return env+"_DATABASE"
with Flow('child') as flow:
env = Parameter('env')
secret_name = get_secret_name(env)
connection = PrefectSecret()(secret_name)
....
If you want to reuse a task across flows:
@task
def get_db(env):
connection = Secret(env+"DATABASE").get()
do_something(connection)
with Flow("...") as flow:
env = Parameter('env')
get_db(env)
so here the Secret is pulled inside the task and the Parameter can be changed on the Flow level.
Does that give ideas?Justin Burchard
04/21/2022, 7:38 PM