-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathreadme_example_dbt_dag.py
More file actions
49 lines (39 loc) · 1.03 KB
/
Copy pathreadme_example_dbt_dag.py
File metadata and controls
49 lines (39 loc) · 1.03 KB
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
39
40
41
42
43
44
45
46
47
48
49
"""An example DAG included in the README.
This example showcases a basic set of Dbt*Operators
"""
import datetime as dt
import pendulum
# from airflow.sdk import DAG in >=3.1
from airflow.providers.common.compat.sdk import DAG
from airflow_dbt_python.operators.dbt import (
DbtRunOperator,
DbtSeedOperator,
DbtTestOperator,
)
args = {
"owner": "airflow",
}
with DAG(
dag_id="example_dbt_operator",
default_args=args,
schedule="0 0 * * *",
start_date=pendulum.today("UTC").add(days=-1),
dagrun_timeout=dt.timedelta(minutes=60),
tags=["example", "example2"],
) as dag:
dbt_test = DbtTestOperator(
task_id="dbt_test",
selector="pre-run-tests",
)
dbt_seed = DbtSeedOperator(
task_id="dbt_seed",
select=["/path/to/first.csv", "/path/to/second.csv"],
full_refresh=True,
)
dbt_run = DbtRunOperator(
task_id="dbt_run",
select=["/path/to/models"],
full_refresh=True,
fail_fast=True,
)
dbt_test >> dbt_seed >> dbt_run