3

我正在尝试使用 AWS 胶水将数据从 AWS RDS (MySQL) 加载到 redshift。我想增量加载数据。通过使用 Job Bookmarks,glue 可以只跟踪新添加的数据,但不能跟踪更新的行。有没有办法只加载更新的数据?可能是通过使用 MySQL 源表中的字段 updated_at 吗?

4

2 回答 2

1

使用作业书签是不可能的。来自 AWS 文档:

Job bookmarks are implemented for a limited use case for a relational database (JDBC connection) input source. For this input source, job bookmarks are supported only if the table's primary keys are in sequential order. Also, job bookmarks search for new rows, but not updated rows. This is because bookmarks look for the primary keys, which already exist.

https://docs.aws.amazon.com/glue/latest/dg/monitor-continuations.html

Glue 需要将整个 RDS 数据加载到动态帧或数据帧中。但是,如果您要避免截断 redshift 表并重新加载所有数据,则可以使用此数据对 redshift 数据库执行 upsert。

https://docs.aws.amazon.com/redshift/latest/dg/c_best-practices-upsert.html

于 2019-06-07T17:09:59.800 回答
1

您可以使用查询通过过滤源 JDBC 数据库中的数据来查找更新的记录,如下例所示。我已将日期作为参数传递,因此在此示例中,每次运行我都只能从 mysql 数据库中获取最新值。

例如,请参考这个答案

于 2019-06-09T03:35:18.543 回答