CDC PostgreSQL 与 Debezium 同时忽略列

问题描述 投票:0回答:1

我有一个包含 10 列的 postgreSQL 表,我们需要在此表上启用 CDC,以仅捕获其中一列的更改,而忽略其他九列。我们的 Debezium 有以下配置:

{
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "database.history.file.filename": "/data/postgresql-d-connection-teste3-history.dat",
    "database.user": "postgres",
    "transforms.Reroute.type": "io.debezium.transforms.ByLogicalTableRouter",
    "database.dbname": "postgres",
    "max.queue.size": "81290",
    "tasks.max": "1",
    "transforms": "Reroute",
    "database.server.name": "xxxx",
    "offset.flush.timeout.ms": "60000",
    "transforms.Reroute.topic.regex": "(.*)",
    "buffer.memory": "2048",
    "database.port": "5432",
    "plugin.name": "wal2json",
    "offset.flush.interval.ms": "10000",
    "tombstones.on.delete": "false",
    "transforms.Reroute.topic.replacement": "teste3",
    "decimal.handling.mode": "string",
    "database.hostname": "xxxx",
    "database.password": "xxxx",
    "name": "postgresql-d-connection-teste3",
    "table.include.list": "public.test",
    "max.batch.size": "20480",
    "database.history": "io.debezium.relational.history.FileDatabaseHistory"
}

我们也已经尝试在 JSON 中设置这些参数,但没有成功:

"column.include.list": "public.test.{id|name}"
"column.exclude.list": "public.test.{id|name}"

我有同样的场景,在 MS SQL Server 上运行良好,我只需要执行这些查询:

EXEC sys.sp_cdc_enable_table
@source_schema = N'xxxx', 
@source_name   = N'xxxx',
@captured_column_list = N'col1, col2, col3
@supports_net_changes = 0

用postgreSQL可以达到同样的目标吗?

提前致谢

postgresql apache-kafka apache-kafka-connect debezium
1个回答
0
投票

我不确定,但根据 postgres 文档,为版本 15 中支持的特定列创建一个发布。 https://www.postgresql.org/docs/current/sql-createpublication.html

我还发现了一篇文章https://www.decodable.co/blog/postgres-15-逻辑-解码-row-filters-with-debezium

© www.soinside.com 2019 - 2024. All rights reserved.