airflow.providers.google.cloud.transfers.cassandra_to_gcs

此模組包含用於將資料從 Cassandra 以 JSON 格式複製到 Google Cloud Storage 的運算子。

屬性

NotSetType

NOT_SET

CassandraToGCSOperator

將資料從 Cassandra 以 JSON 格式複製到 Google Cloud Storage。

模組內容

airflow.providers.google.cloud.transfers.cassandra_to_gcs.NotSetType[source]
airflow.providers.google.cloud.transfers.cassandra_to_gcs.NOT_SET[source]
class airflow.providers.google.cloud.transfers.cassandra_to_gcs.CassandraToGCSOperator(*, cql, bucket, filename, schema_filename=None, approx_max_file_size_bytes=1900000000, gzip=False, cassandra_conn_id='cassandra_default', gcp_conn_id='google_cloud_default', impersonation_chain=None, query_timeout=NOT_SET, encode_uuid=True, **kwargs)[source]

基類: airflow.models.BaseOperator

將資料從 Cassandra 以 JSON 格式複製到 Google Cloud Storage。

注意:不支援陣列的陣列。

引數:
  • cql (str) – 在 Cassandra 表上執行的 CQL。

  • bucket (str) – 要上傳到的儲存桶。

  • filename (str) – 上傳到 Google Cloud Storage 時用作物件名稱的檔名。檔名中應指定 {},以便運算子在檔案因大小拆分時注入檔案編號。

  • schema_filename (str | None) – 如果設定,則這是上傳包含從 MySQL 匯出的表對應的 BigQuery 模式欄位的 .json 檔案時用作物件名稱的檔名。

  • approx_max_file_size_bytes (int) – 此運算子支援將大型表匯出拆分成多個檔案的功能(參見上面檔名引數文件中的注意事項)。此引數允許開發者指定拆分後的檔案大小。請檢視 https://cloud.google.com/storage/quotas 以瞭解單個物件的最大允許檔案大小。

  • cassandra_conn_id (str) – 對特定 Cassandra Hook 的引用。

  • gzip (bool) – 上傳時壓縮檔案的選項

  • gcp_conn_id (str) – (可選)用於連線到 Google Cloud 的連線 ID。

  • impersonation_chain (str | collections.abc.Sequence[str] | None) – (可選)用於使用短期憑據模擬的服務賬號,或獲取列表中最後一個賬號的 access_token 所需的鏈式賬號列表,該賬號將在請求中被模擬。如果設定為字串,該賬號必須授予原始賬號 Service Account Token Creator IAM 角色。如果設定為序列,列表中的身份必須授予緊前身份 Service Account Token Creator IAM 角色,列表中第一個賬號將此角色授予原始賬號(模板化)。

  • query_timeout (float | None | NotSetType) – (可選)執行 Cassandra 查詢所用的時間量,以秒為單位。如果未設定,超時值將由 Cassandra 驅動程式在 Session.execute() 中設定。如果設定為 None,則沒有超時。

  • encode_uuid (bool) – (可選)從 Cassandra 上傳到 GCS 時是否編碼 UUID 的選項。預設為編碼 UUID。

template_fields: collections.abc.Sequence[str] = ('cql', 'bucket', 'filename', 'schema_filename', 'impersonation_chain')[source]
template_ext: collections.abc.Sequence[str] = ('.cql',)[source]
ui_color = '#a0e08c'[source]
cql[source]
bucket[source]
filename[source]
schema_filename = None[source]
approx_max_file_size_bytes = 1900000000[source]
cassandra_conn_id = 'cassandra_default'[source]
gcp_conn_id = 'google_cloud_default'[source]
gzip = False[source]
impersonation_chain = None[source]
query_timeout[source]
encode_uuid = True[source]
CQL_TYPE_MAP[source]
execute(context)[source]

建立運算子時派生。

上下文與渲染 jinja 模板時使用的字典相同。

有關更多上下文資訊,請參閱 get_template_context。

generate_data_dict(names, values)[source]

生成將儲存為 GCS 檔案的資料結構。

convert_value(value)[source]

將值轉換為 BQ 型別。

convert_array_types(value)[source]

將 convert_value 對映到陣列。

convert_user_type(value)[source]

將使用者型別轉換為包含 n 個欄位的 RECORD,其中 n 是屬性的數量。

使用者型別類中的每個元素都將轉換為其在 BQ 中的相應資料型別。

convert_tuple_type(values)[source]

將元組轉換為包含 n 個欄位的 RECORD。

每個欄位都將轉換為其在 BQ 中的相應資料型別,並命名為 'field_<index>',其中 index 由 cassandra 中定義的元組元素的順序決定。

convert_map_type(value)[source]

將 map 轉換為包含兩個欄位('key' 和 'value')的重複 RECORD。

每個都將轉換為其在 BQ 中的相應資料型別。

classmethod generate_schema_dict(name, type_)[source]

生成 BQ 模式。

classmethod get_bq_fields(type_)[source]

將非簡單型別值轉換為 BQ 表示。

static is_simple_type(type_)[source]

檢查型別是否為簡單型別。

static is_array_type(type_)[source]

檢查型別是否為陣列型別。

static is_record_type(type_)[source]

檢查 RECORD 型別。

classmethod get_bq_type(type_)[source]

將型別轉換為等效的 BQ 型別。

classmethod get_bq_mode(type_)[source]

將型別轉換為等效的 BQ 模式。

此條目是否有幫助?