blob: a70dac854269d7789f4054d197e8b6c09602c62b [file] [log] [blame]
:mod:`airflow.contrib.operators.spark_sql_operator`
===================================================
.. py:module:: airflow.contrib.operators.spark_sql_operator
Module Contents
---------------
.. py:class:: SparkSqlOperator(sql, conf=None, conn_id='spark_sql_default', total_executor_cores=None, executor_cores=None, executor_memory=None, keytab=None, principal=None, master='yarn', name='default-name', num_executors=None, verbose=True, yarn_queue='default', *args, **kwargs)
Bases: :class:`airflow.models.BaseOperator`
Execute Spark SQL query
:param sql: The SQL query to execute. (templated)
:type sql: str
:param conf: arbitrary Spark configuration property
:type conf: str (format: PROP=VALUE)
:param conn_id: connection_id string
:type conn_id: str
:param total_executor_cores: (Standalone & Mesos only) Total cores for all
executors (Default: all the available cores on the worker)
:type total_executor_cores: int
:param executor_cores: (Standalone & YARN only) Number of cores per
executor (Default: 2)
:type executor_cores: int
:param executor_memory: Memory per executor (e.g. 1000M, 2G) (Default: 1G)
:type executor_memory: str
:param keytab: Full path to the file that contains the keytab
:type keytab: str
:param master: spark://host:port, mesos://host:port, yarn, or local
:type master: str
:param name: Name of the job
:type name: str
:param num_executors: Number of executors to launch
:type num_executors: int
:param verbose: Whether to pass the verbose flag to spark-sql
:type verbose: bool
:param yarn_queue: The YARN queue to submit to (Default: "default")
:type yarn_queue: str
.. attribute:: template_fields
:annotation: = ['_sql']
.. attribute:: template_ext
:annotation: = ['.sql', '.hql']
.. method:: execute(self, context)
Call the SparkSqlHook to run the provided sql query
.. method:: on_kill(self)