Skip to content

add optional run vars for dbt seed,run,test #73

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

Open
wants to merge 1 commit into
base: main
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
12 changes: 12 additions & 0 deletions ea_airflow_util/dags/run_dbt_airflow_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def __init__(self,
full_refresh: bool = False,
full_refresh_schedule: Optional[str] = None,

seed_vars: Optional[dict] = None,
run_vars: Optional[dict] = None,
test_vars: Optional[dict] = None,

opt_swap: bool = False,
opt_dest_schema: Optional[str] = None,
opt_swap_target: Optional[str] = None,
Expand All @@ -72,6 +76,11 @@ def __init__(self,
self.full_refresh = full_refresh
self.full_refresh_schedule = full_refresh_schedule

# run-time vars
self.seed_vars = seed_vars
self.run_vars = run_vars
self.test_vars = run_vars

# bluegreen
self.opt_swap = opt_swap
self.opt_dest_schema = opt_dest_schema
Expand Down Expand Up @@ -166,6 +175,7 @@ def build_dbt_run(self, on_success_callback=None, **kwargs):
dbt_bin= self.dbt_bin_path,
trigger_rule='all_success',
full_refresh=True,
vars=self.seed_vars,
dag=self.dag
)

Expand All @@ -175,6 +185,7 @@ def build_dbt_run(self, on_success_callback=None, **kwargs):
target = self.dbt_target_name,
dbt_bin= self.dbt_bin_path,
full_refresh=self.full_refresh,
vars=self.run_vars,
dag=self.dag
)

Expand All @@ -183,6 +194,7 @@ def build_dbt_run(self, on_success_callback=None, **kwargs):
dir = self.dbt_repo_path,
target = self.dbt_target_name,
dbt_bin= self.dbt_bin_path,
vars=self.test_vars,
dag=self.dag
)

Expand Down