Skip to content

Configure dbt_resource in job config #8543

Answered by yuhan
dagsir[bot] bot asked this question in Q&A
Discussion options

You must be logged in to vote

Surfacing an answer from Slack:

In code I've passed dbt_cli_recource from dagster_dbt directly into resource_defs in to_job graph method.

my_graph.py

from dagster_dbt import dbt_cli_resource

@op(required_resource_keys={"my_dbt_resource"})
def dbt_run(context):
    context.resources.my_dbt_resource.run()

@graph
def my_graph():
    dbt_run()

my_job = my_graph.to_job(
    resource_defs={
        'my_dbt_resource': dbt_cli_resource
    }
)

config yml:

resources:
  my_dbt_resource:
    config:
      project_dir: "my/project/dir"
      dbt_executable: "my/dbt/executable"

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
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
None yet
1 participant