如何将现有的发电机表架构导出到JSON? [英] How to export an existing dynamo table schema to json?

查看:70
本文介绍了如何将现有的发电机表架构导出到JSON?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一些动态表(仅模式)复制到我的本地环境中以进行测试。首先,我尝试过:

I'd like to replicate some dynamodb tables, schema only, into my local environment for testing purposes. First I've tried:

aws dynamodb describe-table --table-name Foo> FooTable.json

但是很明显,输出模式与 create-table中的输入模式不兼容命令:

But it's obvious that the output schema is not compliant to the input schema from the create-table command:

aws dynamodb create-table --cli-input-json文件://FooTable.json- -endpoint = http:// localhost:8000

我要避免的是用<$ c $生成数十个骨架c> aws dynamodb create-table --generate-cli-skeleton 并手动填充它们:/

What I'm trying to avoid is to generate dozens of skeletons with aws dynamodb create-table --generate-cli-skeleton and fill them manually :/

有没有一种获取表的方法模式是否对娱乐有用?我觉得难以置信,没有任何简单的方法可以通过Web图形界面或标准的aws命令行来做到这一点-在听到他们的服务是多么好之后。

Is there a way to get the table schema in a format that is "useful" for recreation? I find it unbelievable that there are no straightforward way of doing it through the web graphic interface or the standard aws command line - after hearing how "good" was their service.

推荐答案

我刚刚使用 bchew / dynamodump 进行了一次完整的转储并还原:

I just managed to do a complete dump and "restore" using bchew/dynamodump:

git clone git@github.com:bchew/dynamodump.git

请注意文档 https:// github中的-schemaOnly 选项。 .com / bchew / dynamodump 。命令是:

Notice the --schemaOnly option in the documentation https://github.com/bchew/dynamodump. Command was:

./dynamodump.py -m backup --schemaOnly --region foo-region --host localhost --srcTable '*' --port 8000 --accessKey fooKey --secretKey barKey

然后您可以使用 -m restore 模式可将数据或模式放回本地dynamodb或所需的任何地方:)

Then you can use the -m restore mode to put the data or schema back into a local dynamodb or wherever desired :)

说,我仍然感到难以置信的是亚马逊的dynamodb工具链有多糟糕。来吧,伙计们。

With that said, I still find it unbelievable how bad is the amazon dynamodb tool-chain. Come on guys.

这篇关于如何将现有的发电机表架构导出到JSON?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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