Module Contents



An operator that submits a presto query to athena.

class*, query, database, output_location, aws_conn_id='aws_default', client_request_token=None, workgroup='primary', query_execution_context=None, result_configuration=None, sleep_time=30, max_polling_attempts=None, log_query=True, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), **kwargs)[source]

Bases: airflow.models.BaseOperator

An operator that submits a presto query to athena.


if the task is killed while it runs, it’ll cancel the athena query that was launched, EXCEPT if running in deferrable mode.

See also

For more information on how to use this operator, take a look at the guide: Run a query in Amazon Athena

  • 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

  • client_request_token (str | None) – Unique token created by user to avoid multiple executions of same query

  • workgroup (str) – Athena workgroup in which query will be run. (templated)

  • query_execution_context (dict[str, str] | None) – Context in which query need to be run

  • result_configuration (dict[str, Any] | None) – Dict with path to store results in and config related to encryption

  • sleep_time (int) – Time (in seconds) to wait between two consecutive calls to check query status on Athena

  • max_polling_attempts (int | None) – Number of times to poll for query state before function exits To limit task execution time, use execution_timeout.

  • log_query (bool) – Whether to log athena query and other execution params when it’s executed. Defaults to True.

ui_color = '#44b5e2'[source]
template_fields: Sequence[str] = ('query', 'database', 'output_location', 'workgroup')[source]
template_ext: Sequence[str] = ('.sql',)[source]

Create and return an AthenaHook.


Run Presto Query on Athena.

execute_complete(context, event=None)[source]

Cancel the submitted athena query.

Was this entry helpful?