airflow.providers.google.cloud.hooks.bigtable
¶
此模組包含 Google Cloud Bigtable Hook。
模組內容¶
類別¶
用於 Google Cloud Bigtable API 的 Hook。 |
- class airflow.providers.google.cloud.hooks.bigtable.BigtableHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[原始碼]¶
繼承:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
用於 Google Cloud Bigtable API 的 Hook。
Hook 中所有使用 project_id 的方法都必須使用關鍵字引數而不是位置引數呼叫。
- delete_instance(instance_id, project_id)[原始碼]¶
刪除指定的 Cloud Bigtable 執行個體。
如果 Cloud Bigtable 執行個體不存在,則引發 google.api_core.exceptions.NotFound 異常。
- create_instance(instance_id, main_cluster_id, main_cluster_zone, project_id, replica_clusters=None, instance_display_name=None, instance_type=enums.Instance.Type.UNSPECIFIED, instance_labels=None, cluster_nodes=None, cluster_storage_type=enums.StorageType.UNSPECIFIED, timeout=None)[原始碼]¶
建立新的執行個體。
- 參數
instance_id (str) – 新執行個體的 ID。
main_cluster_id (str) – 新執行個體主要叢集的 ID。
main_cluster_zone (str) – 主要叢集的區域。詳情請參閱 https://cloud.google.com/bigtable/docs/locations。
project_id (str) – (選填) BigTable 所在的 Google Cloud 專案 ID。如果設定為 None 或遺失,則會使用 Google Cloud 連線中的預設 project_id。
replica_clusters (list[dict[str, str]] | None) – (選填) 新執行個體的複本叢集清單。每個叢集字典包含一個 id 和一個區域。範例:[{“id”: “replica-1”, “zone”: “us-west1-a”}]
instance_type (google.cloud.bigtable.enums.Instance.Type) – (選填) 執行個體的類型。
instance_display_name (str | None) – (選填) 執行個體的人性化名稱。預設為
instance_id
。instance_labels (dict | None) – (選填) 要與執行個體關聯的標籤字典。
cluster_nodes (int | None) – (選填) 叢集的節點數。
cluster_storage_type (google.cloud.bigtable.enums.StorageType) – (選填) 儲存類型。
timeout (float | None) – (選填) 執行個體建立的逾時時間 (秒)。如果未指定 None,Operator 將無限期等待。
- update_instance(instance_id, project_id, instance_display_name=None, instance_type=None, instance_labels=None, timeout=None)[原始碼]¶
更新現有的執行個體。
- 參數
instance_id (str) – 現有執行個體的 ID。
project_id (str) – (選填) BigTable 所在的 Google Cloud 專案 ID。如果設定為 None 或遺失,則會使用 Google Cloud 連線中的預設 project_id。
instance_display_name (str | None) – (選填) 執行個體的人性化名稱。
instance_type (google.cloud.bigtable.enums.Instance.Type | enum.IntEnum | None) – (選填) 執行個體的類型。
instance_labels (dict | None) – (選填) 要與執行個體關聯的標籤字典。
timeout (float | None) – (選填) 執行個體更新的逾時時間 (秒)。如果未指定 None,Operator 將無限期等待。
- static create_table(instance, table_id, initial_split_keys=None, column_families=None)[原始碼]¶
建立指定的 Cloud Bigtable 資料表。
如果資料表存在,則引發
google.api_core.exceptions.AlreadyExists
異常。- 參數
instance (google.cloud.bigtable.instance.Instance) – 擁有資料表的 Cloud Bigtable 執行個體。
table_id (str) – 要在 Cloud Bigtable 中建立的資料表 ID。
initial_split_keys (list | None) – (選填) 以位元組為單位的列鍵清單,用於初始分割資料表。
column_families (dict[str, google.cloud.bigtable.column_family.GarbageCollectionRule] | None) – (選填) 要建立的欄位對應。鍵是 column_id 字串,值是
google.cloud.bigtable.column_family.GarbageCollectionRule
。
- delete_table(instance_id, table_id, project_id)[原始碼]¶
刪除 Cloud Bigtable 中指定的資料表。
如果資料表不存在,則引發 google.api_core.exceptions.NotFound 異常。
- static update_cluster(instance, cluster_id, nodes)[原始碼]¶
更新指定 Cloud Bigtable 叢集中的節點數。
如果叢集不存在,則引發 google.api_core.exceptions.NotFound 異常。
- 參數
instance (google.cloud.bigtable.instance.Instance) – 擁有叢集的 Cloud Bigtable 執行個體。
cluster_id (str) – 叢集的 ID。
nodes (int) – 所需的節點數。
- static get_column_families_for_table(instance, table_id)[原始碼]¶
擷取 Cloud Bigtable 中指定資料表的欄位族。
- 參數
instance (google.cloud.bigtable.instance.Instance) – 擁有資料表的 Cloud Bigtable 執行個體。
table_id (str) – 要從中擷取欄位族的 Cloud Bigtable 資料表 ID。
- static get_cluster_states_for_table(instance, table_id)[原始碼]¶
擷取 Cloud Bigtable 中指定資料表的叢集狀態。
如果資料表不存在,則引發 google.api_core.exceptions.NotFound 異常。
- 參數
instance (google.cloud.bigtable.instance.Instance) – 擁有資料表的 Cloud Bigtable 執行個體。
table_id (str) – 要從中擷取叢集狀態的 Cloud Bigtable 資料表 ID。