airflow.providers.google.cloud.transfers.postgres_to_gcs

PostgreSQL 到 GCS 運算子。

模組內容

類別

PostgresToGCSOperator

以 JSON、CSV 或 Parquet 格式從 Postgres 複製資料到 Google Cloud Storage。

class airflow.providers.google.cloud.transfers.postgres_to_gcs.PostgresToGCSOperator(*, postgres_conn_id='postgres_default', use_server_side_cursor=False, cursor_itersize=2000, **kwargs)[原始碼]

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

以 JSON、CSV 或 Parquet 格式從 Postgres 複製資料到 Google Cloud Storage。

另請參閱

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

參數
  • postgres_conn_id – 參考特定的 Postgres Hook。

  • use_server_side_cursor – 是否應使用伺服器端游標查詢 postgres。如需詳細資訊,請查看 https://www.psycopg.org/docs/usage.html#server-side-cursors

  • cursor_itersize – 在伺服器端游標的情況下,一次提取多少筆記錄。

ui_color = '#a0e08c'[原始碼]
type_map[原始碼]
query()[原始碼]

查詢 Postgres 並傳回結果的游標。

field_to_bigquery(field)[原始碼]

將 DBAPI 欄位轉換為 BigQuery 綱要格式。

convert_type(value, schema_type, stringify_dict=True)[原始碼]

從 Postgres 取得值,並將其轉換為對 JSON/Google Cloud Storage/BigQuery 安全的值。

時區感知型 Datetime 會轉換為 UTC 秒數。未感知型 Datetime、Date 和 Time 會轉換為 ISO 格式字串。Decimal 會轉換為浮點數。

參數
  • value – Postgres 欄位值。

  • schema_type – BigQuery 資料類型。

  • stringify_dict – 指定是否將 dict 轉換為字串。

此條目是否有幫助?