airflow.providers.amazon.aws.hooks.redshift_cluster

RedshiftHook

与 Amazon Redshift 交互。

模块内容

class airflow.providers.amazon.aws.hooks.redshift_cluster.RedshiftHook(*args, **kwargs)[source]

基类: airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook

与 Amazon Redshift 交互。

这是对 boto3.client("redshift") 的精简包装。

可以指定附加参数(例如 aws_conn_id),这些参数将传递给底层的 AwsBaseHook。

template_fields: collections.abc.Sequence[str] = ('cluster_identifier',)[source]
create_cluster(cluster_identifier, node_type, master_username, master_user_password, params)[source]

使用指定参数创建新的集群。

参数:
  • cluster_identifier (str) – 集群的唯一标识符。

  • node_type (str) – 为集群预置的节点类型。有效值: ds2.xlarge, ds2.8xlarge, dc1.large, dc1.8xlarge, dc2.large, dc2.8xlarge, ra3.xlplus, ra3.4xlarge, 和 ra3.16xlarge

  • master_username (str) – 与正在创建的集群的管理员用户账户关联的用户名。

  • master_user_password (str) – 与正在创建的集群的管理员用户账户关联的密码。

  • params (dict[str, Any]) – 剩余的 AWS Create cluster API 参数。

cluster_status(cluster_identifier)[source]

获取集群的状态。

参数:

cluster_identifier (str) – 集群的唯一标识符

async cluster_status_async(cluster_identifier)[source]
delete_cluster(cluster_identifier, skip_final_cluster_snapshot=True, final_cluster_snapshot_identifier=None)[source]

删除集群并可选择创建快照。

参数:
  • cluster_identifier (str) – 集群的唯一标识符

  • skip_final_cluster_snapshot (bool) – 确定是否创建集群快照

  • final_cluster_snapshot_identifier (str | None) – 最终集群快照的名称

describe_cluster_snapshots(cluster_identifier)[source]

列出集群的快照。

参数:

cluster_identifier (str) – 集群的唯一标识符

restore_from_cluster_snapshot(cluster_identifier, snapshot_identifier)[source]

从快照恢复集群。

参数:
  • cluster_identifier (str) – 集群的唯一标识符

  • snapshot_identifier (str) – 集群快照的唯一标识符

create_cluster_snapshot(snapshot_identifier, cluster_identifier, retention_period=-1, tags=None)[source]

创建集群快照。

参数:
  • snapshot_identifier (str) – 集群快照的唯一标识符

  • cluster_identifier (str) – 集群的唯一标识符

  • retention_period (int) – 手动快照的保留天数。如果值为 -1,则手动快照将永久保留。

  • tags (list[Any] | None) – 标签实例列表

get_cluster_snapshot_status(snapshot_identifier)[source]

获取 Redshift 集群快照状态。

如果未找到集群快照,则返回 None

参数:

snapshot_identifier (str) – 您请求的快照的唯一标识符

此条目是否有帮助?