Wen Hou
06/17/2022, 6:49 PM1. read table 1,2 from a resource (postgres or snowflake)
2. join tables together with id column with join-op
3. OR union table together by simple appending with append-op
4. writes back to another resource,
i read through the dynamic graph section in the doc but don’t seem to be able to programmatically pick which ops to use for step 2 or 3, i am see a way to access user config from @job
or @repository
, any idea how to achieve this? Thanks!claire
06/17/2022, 7:41 PM@op(
out={"downstream_join": Out(is_required=False), "downstream_union": Out(is_required=False)},
config_schema={"downstream_join": boolean},
)
def my_op(context):
my_output = 1
if context.op_config["downstream_join"] == True:
yield Output(my_output, "downstream_join")
else:
yield Output(my_output, "downstream_union")
@op
def join(table):
return 1
@op
def union(table):
return 1
@job
def my_job():
downstream_join, downstream_union = my_op()
join(downstream_join)
union(downstream_union)
The example above defines two optional outputs, and from op config will select which downstream op to run. Then, it will only return an output for the selected downstream op.Wen Hou
06/17/2022, 7:47 PM@job
or @repository
do not have access to runtime config?claire
06/17/2022, 8:02 PMWen Hou
06/17/2022, 9:19 PM