airflow.providers.google.cloud.transfers.postgres_to_gcs

PostgreSQL 到 GCS 操作符。

PostgresToGCSOperator

将数据从 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 – 在使用服务器端游标时,一次获取多少条记录。

ui_color = '#a0e08c'[source]
type_map[source]
postgres_conn_id = 'postgres_default'[source]
use_server_side_cursor = False[source]
cursor_itersize = 2000[source]
property db_hook: airflow.providers.postgres.hooks.postgres.PostgresHook[source]
query()[source]

查询 Postgres 并返回结果游标。

field_to_bigquery(field)[source]

将 DBAPI 字段转换为 BigQuery schema 格式。

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 转换为字符串。

get_openlineage_facets_on_start()[source]

这篇条目有帮助吗?