airflow.operators.mysql_operator

Module Contents

class airflow.operators.mysql_operator.MySqlOperator(sql, mysql_conn_id='mysql_default', parameters=None, autocommit=False, database=None, *args, **kwargs)[source]

Bases: airflow.models.BaseOperator

Executes sql code in a specific MySQL database

Parameters
  • sql (str or list[str]) – the sql code to be executed. Can receive a str representing a sql statement, a list of str (sql statements), or reference to a template file. Template reference are recognized by str ending in ‘.sql’ (templated)

  • mysql_conn_id (str) – reference to a specific mysql database

  • parameters (mapping or iterable) – (optional) the parameters to render the SQL query with.

  • autocommit (bool) – if True, each command is automatically committed. (default value: False)

  • database (str) – name of database which overwrite defined one in connection

template_fields = ['sql'][source]
template_ext = ['.sql'][source]
ui_color = #ededed[source]
execute(self, context)[source]