-
Notifications
You must be signed in to change notification settings - Fork 132
/
performance_dag.py
38 lines (32 loc) · 983 Bytes
/
performance_dag.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
An Airflow DAG that uses Cosmos to render a dbt project for performance testing.
"""
import os
from datetime import datetime
from pathlib import Path
from cosmos import DbtDag, ProfileConfig, ProjectConfig, 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))
profile_config = ProfileConfig(
profile_name="default",
target_name="dev",
profile_mapping=PostgresUserPasswordProfileMapping(
conn_id="example_conn",
profile_args={"schema": "public"},
),
)
cosmos_perf_dag = DbtDag(
project_config=ProjectConfig(
DBT_ROOT_PATH / "perf",
),
profile_config=profile_config,
render_config=RenderConfig(
dbt_deps=False,
),
# normal dag parameters
schedule_interval=None,
start_date=datetime(2024, 1, 1),
catchup=False,
dag_id="performance_dag",
)