Skip to content

How to use a custom resource key when using @dbt_assets #19079

Discussion options

You must be logged in to vote

In our API examples, we use Pythonic Dagster Resources. There, the parameter name of the resource is associated with the resource key in the Definitions object. Here's some relevant documentation.

So, you can just customize the parameter name if you want to use a different resource key, similar to customizing dbt_resource_key in load_assets_from_dbt_project or load_assets_from_dbt_manifest. Here's an example, with the relevant lines highlighted.

@dbt_assets(manifest=dbt_manifest_path)
def jaffle_shop_dbt_assets(
+   context: AssetExecutionContext, my_custom_dbt_resource_key: DbtCliResource
):
    yield from my_custom_dbt_resource_key.cli(["build"], context=context).stream()
    
defs = De…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@brandybobandyistaken
Comment options

@ldnicolasmay
Comment options

@rexledesma
Comment options

Answer selected by rexledesma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
integration: dbt Related to dagster-dbt
3 participants
Converted from issue

This discussion was converted from issue #19075 on January 08, 2024 20:20.