airflow.providers.google.cloud.transfers.postgres_to_gcs¶
PostgreSQL 到 GCS 運算子。
類¶
將資料從 Postgres 複製到 Google Cloud Storage,格式為 JSON、CSV 或 Parquet。 |
模組內容¶
- class airflow.providers.google.cloud.transfers.postgres_to_gcs.PostgresToGCSOperator(*, postgres_conn_id='postgres_default', use_server_side_cursor=False, cursor_itersize=2000, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.transfers.sql_to_gcs.BaseSQLToGCSOperator將資料從 Postgres 複製到 Google Cloud Storage,格式為 JSON、CSV 或 Parquet。
另請參閱
有關如何使用此運算子的更多資訊,請參閱指南:PostgresToGCSOperator
- 引數:
postgres_conn_id – 引用特定的 Postgres Hook。
use_server_side_cursor – 是否應使用伺服器端遊標查詢 postgres。詳細資訊請檢視 https://www.psycopg.org/docs/usage.html#server-side-cursors
cursor_itersize – 在使用伺服器端遊標時,一次獲取多少條記錄。
- property db_hook: airflow.providers.postgres.hooks.postgres.PostgresHook[source]¶
- convert_type(value, schema_type, stringify_dict=True)[source]¶
從 Postgres 獲取一個值,並將其轉換為可安全用於 JSON/Google Cloud Storage/BigQuery 的值。
時區感知的 Datetime 被轉換為 UTC 秒。非時區感知的 Datetime、Date 和 Time 被轉換為 ISO 格式的字串。 Decimal 被轉換為浮點數。
- 引數:
value – Postgres 列值。
schema_type – BigQuery 資料型別。
stringify_dict – 指定是否將 dict 轉換為字串。