airflow.providers.postgres.operators.postgres

Module Contents

class airflow.providers.postgres.operators.postgres.PostgresOperator(*, sql: str, postgres_conn_id: str = 'postgres_default', autocommit: bool = False, parameters: Optional[Union[Mapping, Iterable]] = None, database: Optional[str] = None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Executes sql code in a specific Postgres database

Parameters
  • sql (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') -- the sql code to be executed. (templated)

  • postgres_conn_id (str) -- reference to a specific postgres database

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

  • parameters (dict or iterable) -- (optional) the parameters to render the SQL query with.

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

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

Was this entry helpful?