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) – 您請求的快照的唯一識別符號

此條目是否有幫助?