diff --git a/dev/dags/jaffle_shop_kubernetes.py b/dev/dags/jaffle_shop_kubernetes.py index 8dc98b65a..0801f2b1e 100644 --- a/dev/dags/jaffle_shop_kubernetes.py +++ b/dev/dags/jaffle_shop_kubernetes.py @@ -17,19 +17,15 @@ from airflow.providers.cncf.kubernetes.secret import Secret from pendulum import datetime -from cosmos import ( - DbtSeedKubernetesOperator, - DbtTaskGroup, - ExecutionConfig, - ExecutionMode, - ProfileConfig, - ProjectConfig, -) +from cosmos import DbtSeedKubernetesOperator, DbtTaskGroup, ExecutionConfig, ExecutionMode, ProfileConfig, RenderConfig from cosmos.profiles import PostgresUserPasswordProfileMapping DEFAULT_DBT_ROOT_PATH = Path(__file__).parent / "dbt" + DBT_ROOT_PATH = Path(os.getenv("DBT_ROOT_PATH", DEFAULT_DBT_ROOT_PATH)) -PROJECT_DIR = DBT_ROOT_PATH / "jaffle_shop" +AIRFLOW_PROJECT_DIR = DBT_ROOT_PATH / "jaffle_shop" + +K8S_PROJECT_DIR = "dags/dbt/jaffle_shop" DBT_IMAGE = "dbt-jaffle-shop:1.0.0" @@ -58,7 +54,7 @@ # [START kubernetes_seed_example] load_seeds = DbtSeedKubernetesOperator( task_id="load_seeds", - project_dir=PROJECT_DIR, + project_dir=K8S_PROJECT_DIR, get_logs=True, schema="public", image=DBT_IMAGE, @@ -89,10 +85,8 @@ }, ), ), - project_config=ProjectConfig(dbt_project_path=PROJECT_DIR), - execution_config=ExecutionConfig( - execution_mode=ExecutionMode.KUBERNETES, - ), + render_config=RenderConfig(dbt_project_path=AIRFLOW_PROJECT_DIR), + execution_config=ExecutionConfig(execution_mode=ExecutionMode.KUBERNETES, dbt_project_path=K8S_PROJECT_DIR), operator_args={ "image": DBT_IMAGE, "get_logs": True,