Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding dpt deps with bash operator #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Adding dpt deps with bash operator
arthur committed May 19, 2022
commit eff2d1258e8fe74c46f7df593705456e863f79eb
9 changes: 8 additions & 1 deletion dags/dbt_advanced.py
Original file line number Diff line number Diff line change
@@ -63,6 +63,13 @@ def make_dbt_task(node, dbt_verb):
env=DBT_ENV,
)

# dbt deps pulls the most recent version of the dependencies listed in your packages.yml from git
dbt_deps = BashOperator(
task_id="dbt_deps",
bash_command=f"dbt deps --profiles-dir {DBT_PROJECT_DIR} --project-dir {DBT_PROJECT_DIR}",
env=DBT_ENV,
)

data = load_manifest()
dbt_tasks = {}

@@ -76,7 +83,7 @@ def make_dbt_task(node, dbt_verb):
if node.split(".")[0] == "model":
# Set dependency to run tests on a model after model runs finishes
node_test = node.replace("model", "test")
dbt_tasks[node] >> dbt_tasks[node_test]
dbt_deps >> dbt_tasks[node] >> dbt_tasks[node_test]
# Set all model -> model dependencies
for upstream_node in data["nodes"][node]["depends_on"]["nodes"]:
upstream_node_type = upstream_node.split(".")[0]