Created
May 4, 2021 23:05
-
-
Save Mark-McCracken/f9d5cd1d404c943f3ad93701e3e5893f to your computer and use it in GitHub Desktop.
An example of using the RefreshDatasourceOperator
This file contains hidden or 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
from datetime import datetime, timedelta | |
from airflow import models | |
from airflow.contrib.operators.bigquery_operator import BigQueryOperator | |
from airflow.operators.tableau_plugin import RefreshDatasourceOperator | |
default_dag_args = { | |
'start_date': datetime(2021, 4, 5), | |
'owner': 'Mark McCracken', | |
'retries': 1, | |
'retry_delay': timedelta(minutes=5), | |
'email_on_failure': True, | |
'email': '[email protected]', | |
'use_legacy_sql': False, | |
'allow_large_results': True | |
} | |
with models.DAG( | |
'business_division.process_area.ETL_stage.task_name', | |
default_args=default_dag_args, | |
schedule_interval='0 6 * * *', | |
catchup=True | |
) as dag: | |
create_tableau_dataset = BigQueryOperator( | |
task_id='create_tableau_dataset', | |
sql='./ingested_data_transformation.sql' | |
) | |
refresh_datasource = RefreshDatasourceOperator( | |
task_id="refresh_datasource", | |
datasource_name="Published Datasource 1" | |
) | |
create_tableau_dataset >> refresh_datasource |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment