blob: 107d1b3ccdfab403201ad3456a4dc580ea2e473e [file] [log] [blame]
:py:mod:`airflow.providers.postgres.operators.postgres`
=======================================================
.. py:module:: airflow.providers.postgres.operators.postgres
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.postgres.operators.postgres.PostgresOperator
.. py:class:: PostgresOperator(*, sql, postgres_conn_id = 'postgres_default', autocommit = False, parameters = None, database = None, runtime_parameters = None, **kwargs)
Bases: :py:obj:`airflow.models.BaseOperator`
Executes sql code in a specific Postgres database
:param sql: the SQL code to be executed as a single string, or
a list of str (sql statements), or a reference to a template file.
Template references are recognized by str ending in '.sql'
:param postgres_conn_id: The :ref:`postgres conn id <howto/connection:postgres>`
reference to a specific postgres database.
:param autocommit: if True, each command is automatically committed.
(default value: False)
:param parameters: (optional) the parameters to render the SQL query with.
:param database: name of database which overwrite defined one in connection
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['sql']
.. py:attribute:: template_fields_renderers
.. py:attribute:: template_ext
:annotation: :Sequence[str] = ['.sql']
.. py:attribute:: ui_color
:annotation: = #ededed
.. 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.