airflow.providers.amazon.aws.hooks.redshift_sql

Module Contents

Classes

RedshiftSQLHook

Execute statements against Amazon Redshift, using redshift_connector

class airflow.providers.amazon.aws.hooks.redshift_sql.RedshiftSQLHook(*args, aws_conn_id='aws_default', **kwargs)[source]

Bases: airflow.providers.common.sql.hooks.sql.DbApiHook

Execute statements against Amazon Redshift, using redshift_connector

This hook requires the redshift_conn_id connection.

Note: For AWS IAM authentication, use iam in the extra connection parameters and set it to true. Leave the password field empty. This will use the “aws_default” connection to get the temporary token unless you override with aws_conn_id when initializing the hook. The cluster-identifier is extracted from the beginning of the host field, so is optional. It can however be overridden in the extra field. extras example: {"iam":true}

Parameters

redshift_conn_id – reference to Amazon Redshift connection id

Note

get_sqlalchemy_engine() and get_uri() depend on sqlalchemy-amazon-redshift

conn_name_attr = 'redshift_conn_id'[source]
default_conn_name = 'redshift_default'[source]
conn_type = 'redshift'[source]
hook_name = 'Amazon Redshift'[source]
supports_autocommit = True[source]
static get_ui_field_behaviour()[source]

Returns custom field behavior

conn()[source]
get_iam_token(conn)[source]

Uses AWSHook to retrieve a temporary password to connect to Redshift. Port is required. If none is provided, default is used for each service

get_uri()[source]

Overrides DbApiHook get_uri to use redshift_connector sqlalchemy dialect as driver name

get_sqlalchemy_engine(engine_kwargs=None)[source]

Overrides DbApiHook get_sqlalchemy_engine to pass redshift_connector specific kwargs

get_table_primary_key(table, schema='public')[source]

Helper method that returns the table primary key :param table: Name of the target table :param schema: Name of the target schema, public by default :return: Primary key columns list

get_conn()[source]

Returns a redshift_connector.Connection object

Was this entry helpful?