My 2cents without knowing your setup or restrictions!
TLDR: –project-dir flag
You’re able to use the dbt package which is great, but may need to examine your path during dag execution. Assuming you have a dbt_project.yml defined here /dbtproject/dbt_project.yml
:
where_am_i = BashOperator(
task_id="pathtest",
bash_command="pwd"
....
)
If this is not {yourpathto}/dbtproject
, then one of the following may help:
bash_command="dbt run --project-dir /yourpathto/dbtproject"
bash_command="cd /yourpathto/dbtproject && dbt run"
Additional:
- potentially related thread
- may need to adjust WORKDIR if in container or your python path
- dbt cloud is a great (and free) product which includes task orchestration and scheduling: I resolved some airflow issues by converting