blob: 2e8fad17e912dc773310bece79d9f2db8ea4070e [file] [log] [blame]
:py:mod:`airflow.providers.microsoft.mssql.operators.mssql`
===========================================================
.. py:module:: airflow.providers.microsoft.mssql.operators.mssql
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.microsoft.mssql.operators.mssql.MsSqlOperator
.. py:class:: MsSqlOperator(*, sql, mssql_conn_id = 'mssql_default', parameters = None, autocommit = False, database = None, **kwargs)
Bases: :py:obj:`airflow.models.BaseOperator`
Executes sql code in a specific Microsoft SQL database
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:MsSqlOperator`
This operator may use one of two hooks, depending on the ``conn_type`` of the connection.
If conn_type is ``'odbc'``, then :py:class:`~airflow.providers.odbc.hooks.odbc.OdbcHook`
is used. Otherwise, :py:class:`~airflow.providers.microsoft.mssql.hooks.mssql.MsSqlHook` is used.
:param sql: the sql code to be executed (templated)
:param mssql_conn_id: reference to a specific mssql database
:param parameters: (optional) the parameters to render the SQL query with.
: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']
.. py:attribute:: template_ext
:annotation: :Sequence[str] = ['.sql']
.. py:attribute:: template_fields_renderers
.. py:attribute:: ui_color
:annotation: = #ededed
.. py:method:: get_hook(self)
Will retrieve hook as determined by :meth:`~.Connection.get_hook` if one is defined, and
:class:`~.MsSqlHook` otherwise.
For example, if the connection ``conn_type`` is ``'odbc'``, :class:`~.OdbcHook` will be used.
.. 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.