-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for source node rendering (#1327)
Add example DAG to run integration tests for source node rendering feature Success Run: https://github.com/astronomer/astronomer-cosmos/actions/runs/11853052767/job/33032439737?pr=1327#step:7:449 Failed Run For Dbt < 1.5 https://github.com/astronomer/astronomer-cosmos/actions/runs/11852864026/job/33031862113?pr=1327 Closes: #1155 Closes: #1229
- Loading branch information
1 parent
8ec46d2
commit 9a19084
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
An example DAG that uses Cosmos to render a dbt project into an Airflow DAG using Cosmos source rendering. | ||
""" | ||
|
||
import os | ||
from datetime import datetime | ||
from pathlib import Path | ||
|
||
from cosmos import DbtDag, ProfileConfig, ProjectConfig, RenderConfig | ||
from cosmos.constants import SourceRenderingBehavior | ||
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)) | ||
|
||
profile_config = ProfileConfig( | ||
profile_name="default", | ||
target_name="dev", | ||
profile_mapping=PostgresUserPasswordProfileMapping( | ||
conn_id="example_conn", | ||
profile_args={"schema": "public"}, | ||
disable_event_tracking=True, | ||
), | ||
) | ||
|
||
source_rendering_dag = DbtDag( | ||
# dbt/cosmos-specific parameters | ||
project_config=ProjectConfig( | ||
DBT_ROOT_PATH / "jaffle_shop", | ||
), | ||
profile_config=profile_config, | ||
operator_args={ | ||
"install_deps": True, # install any necessary dependencies before running any dbt command | ||
"full_refresh": True, # used only in dbt commands that support this flag | ||
}, | ||
render_config=RenderConfig(source_rendering_behavior=SourceRenderingBehavior.ALL), | ||
# normal dag parameters | ||
schedule_interval="@daily", | ||
start_date=datetime(2024, 1, 1), | ||
catchup=False, | ||
dag_id="source_rendering_dag", | ||
default_args={"retries": 2}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters