将实木复合地板转换为json以进行dynamodb导入 [英] convert parquet to json for dynamodb import

查看:94
本文介绍了将实木复合地板转换为json以进行dynamodb导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用AWS Glue作业以拼花格式备份s3的dynamodb表,以便能够在Athena中使用它。

I am using AWS Glue jobs to backup dynamodb tables in s3 in parquet format to be able to use it in Athena.

如果我想使用这些拼花格式s3文件能够在dynamodb中还原表,这就是我的想法-读取每个实木复合地板文件并将其转换为json,然后将json格式的数据插入dynamodb中(在下面几行中使用pyspark)

If I want to use these parquet format s3 files to be able to do restore of the table in dynamodb, this is what I am thinking - read each parquet file and convert it into json and then insert the json formatted data into dynamodb (using pyspark on the below lines)

# set sql context
parquetFile = sqlContext.read.parquet(input_file)
parquetFile.write.json(output_path)

使用- https://github.com/Alonreznik/dynamodb-json

这种方法可以听起来对吗?此方法还有其他替代方法吗?

Does this approach sound right? Are there any other alternatives to this approach?

推荐答案

您的方法可以使用,但是您可以直接写入DynamoDB。运行 pyspark 时,只需导入几个 jar 。看看这个:
https://github.com/audienceproject/spark-dynamodb

Your approach will work, but you can write directly to DynamoDB. You just need to import a few jars when you run pyspark. Have a look at this: https://github.com/audienceproject/spark-dynamodb

希望这会有所帮助。

这篇关于将实木复合地板转换为json以进行dynamodb导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆