dbt_assets
yields multiple outputs to one op
#25134
-
Hello everyone 👋 I want to create a job that has one I've tried multiple ways without luck. I'm not sure if I'm missing something. Here's a code example: @dbt_assets(
manifest=manifest,
select="my_dbt_project.models.assets"
)
def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
yield from dbt.cli(["build", "--target", "dev"], context=context).stream()
@op(ins={"start": In(Nothing)})
def downstream_op(context):
pass
@job
def my_dbt_job():
downstream_op(start=my_dbt_assets()) The error I constantly get is received a tuple of multiple outputs for input "start" (passed by keyword) in op invocation downstream_op. Must pass individual output, available from tuple Any suggestions are more than welcome. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I think this is not technically doable as the |
Beta Was this translation helpful? Give feedback.
-
I managed to create the dependency using
@dbt_assets(
manifest=manifest,
select="my_dbt_project.models.assets"
)
def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
yield from dbt.cli(["build", "--target", "dev"], context=context).stream()
@op(ins={"start": In(Nothing)})
def downstream_op(context):
pass
@job()
def my_dbt_job():
dbt_assets = my_dbt_assets()
assets = [asset for asset in dbt_assets]
downstream_op(assets) With assets, it is nicer because we have the full potential of the assets graph, materialization, etc.
@dbt_assets(
manifest=manifest,
select="my_dbt_project.models.assets"
)
def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
yield from dbt.cli(["build", "--target", "dev"], context=context).stream()
@asset(deps=my_dbt_assets.keys)
def downstream_asset(context: AssetExecutionContext):
pass
my_dbt_job = define_asset_job(
name="my_dbt_job",
selection=[my_dbt_assets, downstream_asset],
) |
Beta Was this translation helpful? Give feedback.
I managed to create the dependency using
ops
and also withassets
. I'll add a few examples of how to achieve this.With assets, it is nicer because we have the full potential of the assets graph, materialization, etc.