airflow.providers.apache.pig.operators.pig

Module Contents

Classes

PigOperator

Executes pig script.

class airflow.providers.apache.pig.operators.pig.PigOperator(*, pig, pig_cli_conn_id='pig_cli_default', pigparams_jinja_translate=False, pig_opts=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Executes pig script.

Parameters
  • pig (str) – the pig latin script to be executed. (templated)

  • pig_cli_conn_id (str) – reference to the Hive database

  • pigparams_jinja_translate (bool) – when True, pig params-type templating ${var} gets translated into jinja-type templating {{ var }}. Note that you may want to use this along with the DAG(user_defined_macros=myargs) parameter. View the DAG object documentation for more details.

  • pig_opts (Optional[str]) – pig options, such as: -x tez, -useHCatalog, …

template_fields :Sequence[str] = ['pig'][source]
template_ext :Sequence[str] = ['.pig', '.piglatin'][source]
ui_color = #f0e4ec[source]
prepare_template(self)[source]

Hook triggered after the templated fields get replaced by their content.

If you need your operator to alter the content of the file before the template is rendered, it should override this method to do so.

execute(self, context)[source]

This is the main method to derive when creating an operator. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

on_kill(self)[source]

Override this method to cleanup subprocesses when a task instance gets killed. Any use of the threading, subprocess or multiprocessing module within an operator needs to be cleaned up or it will leave ghost processes behind.

Was this entry helpful?