Last active
June 7, 2019 19:29
-
-
Save mrshu/6e0ad1256a599083608d7c8eed1f565f to your computer and use it in GitHub Desktop.
Simple Templated Athena Query
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
from airflow.models import DAG | |
from airflow.contrib.operators.aws_athena_operator import AWSAthenaOperator | |
from datetime import datetime | |
with DAG(dag_id='simple_athena_query', | |
schedule_interval=None, | |
start_date=datetime(2019, 5, 21)) as dag: | |
run_query = AWSAthenaOperator( | |
task_id='run_query', | |
query="select * from UNNEST(SEQUENCE(DATE('2019-05-01'), date_trunc('day', DATE('{{ ds }}')), INTERVAL '1' DAY))", | |
output_location='s3://my-bucket/my-path/', | |
database='my_database' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment