简体   繁体   English

将选择性数据从一个 dynamodb 表导出到同一区域中的另一个表的选项

[英]Options to export selective data from one dynamodb table to another table in same region

Need to move data from one dynamodb table to another table after doing a transformation在进行转换后需要将数据从一个 dynamodb 表移动到另一个表

What is the best approach to do that最好的方法是什么

Do I need to write a script to read selective data from one table and put in another table我是否需要编写脚本从一个表中读取选择性数据并放入另一个表中

or Do I need to follow CSV export或者我需要按照 CSV 出口

You need to write a script to do so.您需要编写一个脚本来执行此操作。 However, you may wish to first export the data to S3 using DynamoDB's native function as it does not impact capacity on the table, ensuring you do not impact production traffic for example.但是,您可能希望首先使用 DynamoDB 的原生 function 将数据导出到 S3,因为它不会影响表的容量,例如确保您不会影响生产流量。

If your table is not serving production traffic or the size of the table is not too large then you can simply use Lambda functions to read your items, transform and then write to the new table.如果您的表不服务生产流量或表的大小不是太大,那么您可以简单地使用 Lambda 函数来读取您的项目,转换然后写入新表。

If your table is large, you can use AWS Glue to achieve the same result in a distributed fashion.如果您的表很大,您可以使用 AWS Glue 以分布式方式实现相同的结果。

Is this a live table that is used on prod?这是在产品上使用的实时表吗?

If it is what I usually do is.如果是我平时做的就是。

  • Enable Dynamo streams (if not already enabled)启用 Dynamo 流(如果尚未启用)
  • Create a lambda function that has access to both tables创建一个可以访问两个表的 lambda function
  • Place transformation logic in the lambda将转换逻辑放在 lambda 中
  • Subscribe the lambda to the dynamo stream订阅 lambda 到发电机 stream
  • Update all fields on the original table (like update a new field called 'migrate')更新原始表上的所有字段(如更新名为“迁移”的新字段)
  • Now all elements will flow through the lambda and it can store them with transformation on the new table现在所有元素都将流经 lambda 并且它可以将它们通过转换存储在新表中
  • You can now switch to the new table您现在可以切换到新表
  • Check if everything still works检查一切是否仍然有效
  • Delete lambda, old table, and disable dynamo streams (if needed)删除 lambda,旧表,并禁用发电机流(如果需要)

This approach is the only one I found that can guarantee 100% uptime during the migration.这种方法是我发现的唯一一种可以保证迁移期间 100% 正常运行时间的方法。

If the table is not live then you can just export it to S3 and then import it into the new table如果该表不存在,那么您可以将其导出到 S3,然后将其导入到新表中

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 DynamoDB 中将一个表复制到另一个表 - Copying one table to another in DynamoDB 可以在 BigQuery 中以原子方式将数据从一个表移动到另一个表吗? - Possible to atomically move data from one table to another in BigQuery? 我们可以从备份恢复到同一个 dynamodb 表吗 - Can we restore to same dynamodb table from backup 如何将一列的数据加载到同一个表的另一列中 - How can I load data of one column into another column in the same table 如何将一个表中的列与 BigQuery 中另一个表中的数组进行比较? - How to compare column in one table with array from another table in BigQuery? 如何从 Lambda NodeJS 查询 DynamoDB 表? - How to query DynamoDB table from Lambda NodeJS? 在 DynamoDB 中使用“OR”并通过另一个表模型进行选择 - Using "OR" and selection by another table model in DynamoDB 如何将数据从一个表复制到另一个表中,该表在 GCP Bigquery 中有一个记录重复列 - How to copy data from one table into another table which has a record repeated column in GCP Bigquery 如何将 AWS DynamoDB 表导出到 S3 存储桶? - How to export an AWS DynamoDB table to an S3 Bucket? 分区键与主表相同时的 DynamoDB GSI 表复制 - DynamoDB GSI table replication when partition key is same as the main table
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM