迁移数据时在 DynamoDB table 中映射属性

Map attributes in DynamoDB table while migrating data

我有两个包含以下项目的 DynamoDB 表:

Table_1

Table_2

这是我需要的:

  1. 将数据从 Table_1 迁移到 Table_2。
  2. 将 Table_1.SomeId 属性映射到 Table_2.Id 属性
  3. 迁移时为 Table_2.Surname
  4. 设置默认值

我看了一下 Amazon Data Pipeline 服务。显然,您可以将数据从 Table_1 导出到 S3。然后,将数据从 S3 导入到 Table_2.

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBPipeline.html

我看不到的是如果表具有不同的架构,如何映射属性。

我找到了基于使用 SDK 从头开始​​编写控制台应用程序的解决方案。对此有更好的建议吗?

我认为解决这个问题的一种方法是使用 Hive。您基本上可以将数据从 Dynamo 加载到 S3,使用 EMR 集群到 运行 Hive 脚本并从 S3 导出回 Dynamo。

这里有一个非常相似的例子: https://github.com/awslabs/data-pipeline-samples/tree/master/samples/DynamoDBToRedshiftConvertDataUsingHive

在此示例中,转换后数据被放入 Redshift,因此您可以用导入步骤替换该步骤。

或者,采用以下示例: https://github.com/awslabs/data-pipeline-samples/blob/master/samples/dynamodb-to-dynamodb/pipeline.json

并在中间添加上一个示例中 EMR 上的 Hive。

希望对您有所帮助。