airflow.providers.postgres.dialects.postgres

Classes

PostgresDialect

Postgres dialect implementation.

Module Contents

class airflow.providers.postgres.dialects.postgres.PostgresDialect(hook, **kwargs)[source]

Bases: airflow.providers.common.sql.dialects.dialect.Dialect

Postgres dialect implementation.

property name: str[source]
get_primary_keys(table, schema=None)[source]

Get the table’s primary key.

Parameters:
  • table (str) – Name of the target table

  • schema (str | None) – Name of the target schema, public by default

Returns:

Primary key columns list

Return type:

list[str] | None

generate_replace_sql(table, values, target_fields, **kwargs)[source]

Generate the REPLACE SQL statement.

Parameters:
  • table – Name of the target table

  • values – The row to insert into the table

  • target_fields – The names of the columns to fill in the table

  • replace – Whether to replace instead of insert

  • replace_index – the column or list of column names to act as index for the ON CONFLICT clause

Returns:

The generated INSERT or REPLACE SQL statement

Return type:

str

Was this entry helpful?