Skip to content

dbt_assets yields multiple outputs to one op #25134

Discussion options

You must be logged in to vote

I managed to create the dependency using ops and also with assets. I'll add a few examples of how to achieve this.

  • ops:
@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.

  • assets
@dbt_assets(
    manifest=manifest,

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@kennycontreras
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by kennycontreras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area: ops/graphs/jobs Related to Dagster ops, graphs and jobs
2 participants