| :py:mod:`airflow.providers.mysql.operators.mysql` |
| ================================================= |
| |
| .. py:module:: airflow.providers.mysql.operators.mysql |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.mysql.operators.mysql.MySqlOperator |
| |
| |
| |
| |
| .. py:class:: MySqlOperator(*, sql, mysql_conn_id = 'mysql_default', parameters = None, autocommit = False, database = None, **kwargs) |
| |
| Bases: :py:obj:`airflow.models.BaseOperator` |
| |
| Executes sql code in a specific MySQL database |
| |
| .. seealso:: |
| For more information on how to use this operator, take a look at the guide: |
| :ref:`howto/operator:MySqlOperator` |
| |
| :param sql: 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) |
| :param mysql_conn_id: Reference to :ref:`mysql connection id <howto/connection:mysql>`. |
| :param parameters: (optional) the parameters to render the SQL query with. |
| Template reference are recognized by str ending in '.json' |
| (templated) |
| :param autocommit: if True, each command is automatically committed. |
| (default value: False) |
| :param database: name of database which overwrite defined one in connection |
| |
| .. py:attribute:: template_fields |
| :annotation: :Sequence[str] = ['sql', 'parameters'] |
| |
| |
| |
| .. py:attribute:: template_fields_renderers |
| |
| |
| |
| |
| .. py:attribute:: template_ext |
| :annotation: :Sequence[str] = ['.sql', '.json'] |
| |
| |
| |
| .. py:attribute:: ui_color |
| :annotation: = #ededed |
| |
| |
| |
| .. py:method:: prepare_template(self) |
| |
| Parse template file for attribute parameters. |
| |
| |
| .. py:method:: execute(self, context) |
| |
| 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. |
| |
| |
| |