-
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
- Loading branch information
1 parent
8ec46d2
commit a8d3dd2
Showing
2 changed files
with
45 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