Cezary Pukownik
12/28/2021, 8:35 AMdbt_resource
in job config, eg. in dagit?
In documentation I've seen only in code configuration using dbt_cli_resource.configured
method. But this requires to set some configs inside the code.
I want to set project_dir
and dbt_executable
outside of code, to have an option to switch between dev and prod envs without chaning code.prha
12/29/2021, 10:56 AMconfigured
portion of the dbt_cli_resource
, but that does mean that you will need to fill in the appropriate section of config at the job level. For example:
# run config yaml
resources:
my_dbt_resource:
config:
project_dir: "my/project/dir"
dbt_executable: "my/dbt/executable"
config
argument for the job itself, and then override as needed in dagit.Cezary Pukownik
12/29/2021, 2:23 PMdbt_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"
yuhan
06/22/2022, 4:00 AMdbt_resource
in job configDagster Bot
06/22/2022, 4:00 AM