This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
145 additions
and
140 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
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 |
---|---|---|
|
@@ -7,23 +7,25 @@ | |
from airflow.utils.dates import datetime | ||
|
||
|
||
TABLE='forestfires' | ||
DATASET='google_sheets' | ||
TABLE = "forestfires" | ||
DATASET = "google_sheets" | ||
# These args will get passed on to each operator | ||
# You can override them on a per-task basis during operator initialization | ||
default_args = { | ||
'owner': 'astronomer', | ||
'depends_on_past': False, | ||
'start_date': datetime(2021, 7, 7), | ||
'email': ['[email protected]'], | ||
'email_on_failure': False | ||
"owner": "astronomer", | ||
"depends_on_past": False, | ||
"start_date": datetime(2021, 7, 7), | ||
"email": ["[email protected]"], | ||
"email_on_failure": False, | ||
} | ||
|
||
with DAG('example_fivetran_bigquery', | ||
default_args=default_args, | ||
description='', | ||
schedule_interval=None, | ||
catchup=False) as dag: | ||
with DAG( | ||
"example_fivetran_bigquery", | ||
default_args=default_args, | ||
description="", | ||
schedule_interval=None, | ||
catchup=False, | ||
) as dag: | ||
""" | ||
### Simple EL Pipeline with Data Integrity and Quality Checks | ||
Before running the DAG, set the following in an Airflow or Environment Variables: | ||
|
@@ -44,16 +46,16 @@ | |
The FivetranSensor monitors the status of the Fivetran data sync | ||
""" | ||
fivetran_sync_start = FivetranOperator( | ||
task_id='fivetran-task', | ||
fivetran_conn_id='fivetran_default', | ||
connector_id='{{ var.value.connector_id }}' | ||
task_id="fivetran-task", | ||
fivetran_conn_id="fivetran_default", | ||
connector_id="{{ var.value.connector_id }}", | ||
) | ||
|
||
fivetran_sync_wait = FivetranSensor( | ||
task_id='fivetran-sensor', | ||
fivetran_conn_id='fivetran_default', | ||
connector_id='{{ var.value.connector_id }}', | ||
poke_interval=5 | ||
task_id="fivetran-sensor", | ||
fivetran_conn_id="fivetran_default", | ||
connector_id="{{ var.value.connector_id }}", | ||
poke_interval=5, | ||
) | ||
|
||
""" | ||
|
@@ -62,10 +64,10 @@ | |
exist. | ||
""" | ||
validate_bigquery = BigQueryTableExistenceSensor( | ||
task_id='validate_bigquery', | ||
project_id='{{ var.value.gcp_project_id }}', | ||
task_id="validate_bigquery", | ||
project_id="{{ var.value.gcp_project_id }}", | ||
dataset_id=DATASET, | ||
table_id='forestfires', | ||
table_id="forestfires", | ||
) | ||
|
||
""" | ||
|
@@ -80,7 +82,7 @@ | |
use_legacy_sql=False, | ||
) | ||
|
||
done = DummyOperator(task_id='done') | ||
done = DummyOperator(task_id="done") | ||
|
||
fivetran_sync_start >> fivetran_sync_wait >> validate_bigquery | ||
validate_bigquery >> check_bq_row_count >> done |
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
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
Oops, something went wrong.