airflow.providers.google.cloud.transfers.mysql_to_gcs

MySQL 到 GCS 運算子。

MySQLToGCSOperator

將資料從 MySQL 複製到 Google Cloud Storage,格式為 JSON、CSV 或 Parquet。

模組內容

class airflow.providers.google.cloud.transfers.mysql_to_gcs.MySQLToGCSOperator(*, mysql_conn_id='mysql_default', ensure_utc=False, **kwargs)[原始碼]

基類: airflow.providers.google.cloud.transfers.sql_to_gcs.BaseSQLToGCSOperator

將資料從 MySQL 複製到 Google Cloud Storage,格式為 JSON、CSV 或 Parquet。

另請參閱

有關如何使用此運算子的更多資訊,請參閱指南: MySQLToGCSOperator

引數:
  • mysql_conn_id – 參考 mysql 連線 ID

  • ensure_utc – 確保 TIMESTAMP 列匯出為 UTC。如果設定為 False,則 TIMESTAMP 列將使用 MySQL 伺服器的預設時區匯出。

ui_color = '#a0e08c'[原始碼]
type_map[原始碼]
mysql_conn_id = 'mysql_default'[原始碼]
ensure_utc = False[原始碼]
property db_hook: airflow.providers.mysql.hooks.mysql.MySqlHook[原始碼]
query()[原始碼]

查詢 mysql 並返回結果遊標。

field_to_bigquery(field)[原始碼]

將 DBAPI 欄位轉換為 BigQuery 模式格式。

convert_type(value, schema_type, **kwargs)[原始碼]

獲取來自 MySQLdb 的值並將其轉換為 JSON/Google Cloud Storage/BigQuery 安全的值。

  • Datetimes 轉換為 str(value) (datetime.isoformat(’ ‘)) 字串。

  • Times 轉換為 str((datetime.min + value).time()) 字串。

  • Decimals 轉換為 floats。

  • 如果給定的 schema_type 是 DATE,Dates 轉換為 ISO 格式字串,否則轉換為 datetime.isoformat(’ ‘) 字串。

  • 如果給定的 schema_type 是 INTEGER,Binary 型別欄位轉換為 integer,否則使用 base64 編碼。根據 BigQuery 文件,匯入的 BYTES 資料必須是 base64 編碼的: https://cloud.google.com/bigquery/data-types

引數:
  • value – MySQLdb 列值

  • schema_type (str) – BigQuery 資料型別

get_openlineage_facets_on_start()[原始碼]

此條目是否有幫助?