Skip to content

Commit 346f278

Browse files
committed
docs: Update example DAGs
1 parent 70e8aaa commit 346f278

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ Currently, the following `dbt` commands are supported:
142142

143143
## Examples
144144

145+
All example DAGs are tested against against `apache-airflow==2.2.5`. Some changes, like modifying `import` statements or changing types, may be required for them to work in other versions.
146+
145147
``` python
146148
from datetime import timedelta
147149

docs/example_dags.rst

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Example DAGs
33

44
This section contains a few DAGs showing off some dbt pipelines to get you going.
55

6+
.. warning::
7+
All example DAGs are tested against against `apache-airflow==2.2.5`. Some changes, like modifying `import` statements or changing types, may be required for them to work in environments running other versions of Airflow.
8+
69
Basic DAG
710
^^^^^^^^^
811

@@ -17,7 +20,7 @@ This basic DAG shows off a single ``DbtRunOperator`` that executes daily:
1720
1821
from airflow import DAG
1922
from airflow.utils.dates import days_ago
20-
from airflow_dbt_python.dbt.operators import DbtRunOperator
23+
from airflow_dbt_python.operators.dbt import DbtRunOperator
2124
2225
with DAG(
2326
dag_id="example_basic_dbt_run",
@@ -53,7 +56,7 @@ This DAG shows off a ``DbtRunOperator`` followed by a ``DbtDocsGenerateOperator`
5356
5457
from airflow import DAG
5558
from airflow.utils.dates import days_ago
56-
from airflow_dbt_python.dbt.operators import DbtDocsGenerateOperator, DbtRunOperator
59+
from airflow_dbt_python.operators.dbt import DbtDocsGenerateOperator, DbtRunOperator
5760
5861
with DAG(
5962
dag_id="example_basic_dbt_run_with_s3",
@@ -62,28 +65,27 @@ This DAG shows off a ``DbtRunOperator`` followed by a ``DbtDocsGenerateOperator`
6265
catchup=False,
6366
dagrun_timeout=dt.timedelta(minutes=60),
6467
) as dag:
68+
# Project files will be pulled from "s3://my-bucket/dbt/profiles/key/prefix/"
69+
dbt_run = DbtRunOperator(
70+
task_id="dbt_run_hourly",
71+
project_dir="s3://my-bucket/dbt/project/key/prefix/",
72+
profiles_dir="s3://my-bucket/dbt/profiles/key/prefix/",
73+
select=["+tag:hourly"],
74+
exclude=["tag:deprecated"],
75+
target="production",
76+
profile="my-project",
77+
full_refresh=False,
78+
)
6579
66-
# Project files will be pulled from "s3://my-bucket/dbt/profiles/key/prefix/"
67-
dbt_run = DbtRunOperator(
68-
task_id="dbt_run_hourly",
69-
project_dir="s3://my-bucket/dbt/project/key/prefix/",
70-
profiles_dir="s3://my-bucket/dbt/profiles/key/prefix/",
71-
select=["+tag:hourly"],
72-
exclude=["tag:deprecated"],
73-
target="production",
74-
profile="my-project",
75-
full_refresh=False,
76-
)
77-
78-
# Documentation files (target/manifest.json, target/index.html, and
79-
# target/catalog.json) will be pushed back to S3 after compilation is done.
80-
dbt_docs = DbtDocsGenerateOperator(
81-
task_id="dbt_run_hourly",
82-
project_dir="s3://my-bucket/dbt/project/key/prefix/",
83-
profiles_dir="s3://my-bucket/dbt/profiles/key/prefix/",
84-
)
80+
# Documentation files (target/manifest.json, target/index.html, and
81+
# target/catalog.json) will be pushed back to S3 after compilation is done.
82+
dbt_docs = DbtDocsGenerateOperator(
83+
task_id="dbt_run_hourly",
84+
project_dir="s3://my-bucket/dbt/project/key/prefix/",
85+
profiles_dir="s3://my-bucket/dbt/profiles/key/prefix/",
86+
)
8587
86-
dbt_run >> dbt_docs
88+
dbt_run >> dbt_docs
8789
8890
Complete dbt workflow
8991
^^^^^^^^^^^^^^^^^^^^^
@@ -102,7 +104,7 @@ This DAG shows off a (almost) complete dbt workflow as it would be run from the
102104
103105
from airflow import DAG
104106
from airflow.utils.dates import days_ago
105-
from airflow_dbt_python.dbt.operators import (
107+
from airflow_dbt_python.operators.dbt import (
106108
DbtRunOperator,
107109
DbtSeedOperator,
108110
DbtSourceOperator,
@@ -180,7 +182,7 @@ The following DAG showcases how to use `dbt artifacts <https://docs.getdbt.com/r
180182
from airflow import DAG
181183
from airflow.operators.python_operator import PythonOperator
182184
from airflow.utils.dates import days_ago
183-
from airflow_dbt_python.dbt.operators import DbtRunOperator
185+
from airflow_dbt_python.operators.dbt import DbtRunOperator
184186
185187
186188
def process_dbt_artifacts(**context):

0 commit comments

Comments
 (0)