关于 Openflow Connector for PostgreSQL¶
备注
This connector is subject to the Snowflake Connector Terms.
本主题介绍 Openflow Connector for PostgreSQL 的基本概念、工作流程和限制。
Openflow Connector for PostgreSQL 可将 PostgreSQL 数据库实例连接到 Snowflake,并近乎实时或按计划从选定表中复制数据。该连接器还会创建一个包含所有数据更改的日志,可与当前已复制的表状态一起使用。
如果您希望实现以下功能,可以使用此连接器:
将 PostgreSQL 表的 CDC 复制到 Snowflake,实现全面集中报告
工作流程¶
数据库管理员 配置 PostgreSQL 复制设置、创建发布,并为连接器准备凭据。或者,他们可以提供 SSL 证书。
Snowflake 账户管理员 执行以下任务:
为连接器创建服务用户、数据仓库和用于复制的目标数据库。
安装连接器。
为流模板指定必需的参数。
运行流程。连接器在 Openflow 中运行时执行以下任务:
创建一个架构,用于日志表。
创建与源表对应的架构和目标表,用于复制。
按照表复制生命周期启动复制。
表复制生命周期¶
架构自检:连接器会发现源表中的列、它们的名称、类型,然后根据 Snowflake 和连接器的限制来验证它们。验证失败会导致此阶段失败,并且周期完成。成功完成架构自检后,连接器将创建一个空目标表。
快照加载:连接器将源表中的所有可用数据复制到目标表中。如果该阶段失败,复制周期结束,后续数据将不再被复制。成功完成后,源表中的整个数据集将在目标表中可用。
增量加载连接器继续跟踪源表中的更改,并将其复制到目标表中。这将一直持续,直到从复制中移除该表。如果该阶段失败,将永久停止源表的复制,直到问题解决。
备注
临时故障(例如连接问题)不会停止任何表的复制,但是永久性故障(例如不支持的数据类型映射)会阻止受影响的表进一步复制,但不会影响其他配置的表复制。解决受影响表的问题后,可以将其移除,然后再次添加到复制中。
TOASTed value support¶
The connector supports replicating tables with TOAST values (https://www.postgresql.org/docs/current/storage-toast.html) for columns of types: array, bytea, json, jsonb, text, varchar, xml.
Whenever the connector encounters a TOASTed value in the CDC stream, it substitutes a default placeholder of __previous_value_unchanged, formatted for the given column type, and stores it in the journal table. The MERGE query then accounts for placeholder values, so that the destination table always contains the last non-TOASTed value.
Out of range value support¶
The connector supports replicating tables with columns of types date, timestamp, and timestamptz that contain out-of-range values.
If the connector encounters an out-of-range value in the CDC stream, it substitutes a default placeholder based on the type of the column.
Column type |
Placeholder value |
|---|---|
|
|
|
|
|
|
备注
-Infinity and Infinity values are also replaced with the respective placeholders for all three types.
支持的 PostgreSQL 版本¶
The following are the supported PostgreSQL versions.
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
|
|---|---|---|---|---|---|---|---|---|
Standard (https://www.postgresql.org/) |
是 |
是 |
是 |
是 |
是 |
是 |
是 |
是 |
AWS RDS (https://docs.aws.amazon.com/AmazonRDS/latest/PostgreSQLReleaseNotes/Welcome.html) |
是 |
是 |
是 |
是 |
是 |
是 |
是 |
是 |
Amazon Aurora (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraPostgreSQLReleaseNotes/Welcome.html) |
是 |
是 |
是 |
是 |
是 |
是 |
是 |
|
GCP Cloud SQL (https://cloud.google.com/sql/docs/postgres/) |
是 |
是 |
是 |
是 |
是 |
是 |
是 |
|
Azure Database (https://learn.microsoft.com/en-us/azure/postgresql/) |
是 |
是 |
是 |
是 |
是 |
是 |
是 |
Openflow 要求¶
运行时大小必须至少为“Medium”。复制大容量数据时请使用更大的运行时环境,尤其是在行大小较大的情况下。
该连接器不支持多节点 Openflow 运行时。使用 Min nodes 配置此连接器的运行时,并将 Max nodes 设置为
1。
限制¶
该连接器支持 PostgreSQL 版本 11 或更高版本。
连接器仅支持使用用户名和密码的方式进行身份验证,以连接 PostgreSQL。
The connector does not replicate tables with data that exceeds Snowflake's type limitations. An exception to this rule is date & time data type columns that contain out-of-range values. For more information, see Out of range value support.
连接器要求每个被复制的表都必须具备一个主键,并且该表的复制标识须与主键相同。
该连接器支持源表架构更改,但不支持更改主键定义、数字列的精度或小数位数。
备注
通过将这些特定列排除在复制范围之外,可以绕过影响某些表列的限制。