airflow.contrib.operators.aws_athena_operator

Module Contents

class airflow.contrib.operators.aws_athena_operator.AWSAthenaOperator(query, database, output_location, aws_conn_id='aws_default', client_request_token=None, query_execution_context=None, result_configuration=None, sleep_time=30, max_tries=None, *args, **kwargs)[source]

Bases: airflow.models.BaseOperator

An operator that submit presto query to athena.

If do_xcom_push is True, the QueryExecutionID assigned to the query will be pushed to an XCom when it successfuly completes.

Parameters
  • query (str) – Presto to be run on athena. (templated)

  • database (str) – Database to select. (templated)

  • output_location (str) – s3 path to write the query results into. (templated)

  • aws_conn_id (str) – aws connection to use

  • sleep_time (int) – Time to wait between two consecutive call to check query status on athena

  • max_tries – Number of times to poll for query state before function exits

ui_color = #44b5e2[source]
template_fields = ['query', 'database', 'output_location'][source]
template_ext = ['.sql'][source]
get_hook(self)[source]
execute(self, context)[source]

Run Presto Query on Athena

on_kill(self)[source]

Cancel the submitted athena query