From 1840c3279dfdaf81f84e04ab350213c3bf795957 Mon Sep 17 00:00:00 2001 From: Rocco Pascale <75824493+ReadytoRocc@users.noreply.github.com> Date: Thu, 7 Nov 2024 14:45:13 -0500 Subject: [PATCH] Generalise example from README (#1311) --- docs/getting_started/astro.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/getting_started/astro.rst b/docs/getting_started/astro.rst index f7e9942bc..b590575f2 100644 --- a/docs/getting_started/astro.rst +++ b/docs/getting_started/astro.rst @@ -90,6 +90,11 @@ In your ``my_cosmos_dag.py`` file, import the ``DbtDag`` class from Cosmos and c from cosmos import DbtDag, ProjectConfig, ProfileConfig, ExecutionConfig from cosmos.profiles import PostgresUserPasswordProfileMapping + import os + from datetime import datetime + + airflow_home = os.environ["AIRFLOW_HOME"] + profile_config = ProfileConfig( profile_name="default", target_name="dev", @@ -101,11 +106,11 @@ In your ``my_cosmos_dag.py`` file, import the ``DbtDag`` class from Cosmos and c my_cosmos_dag = DbtDag( project_config=ProjectConfig( - "/usr/local/airflow/dags/my_dbt_project", + f"{airflow_home}/dags/my_dbt_project", ), profile_config=profile_config, execution_config=ExecutionConfig( - dbt_executable_path=f"{os.environ['AIRFLOW_HOME']}/dbt_venv/bin/dbt", + dbt_executable_path=f"{airflow_home}/dbt_venv/bin/dbt", ), # normal dag parameters schedule_interval="@daily",