本文介绍了通过CLI的AWS DynamoDB放置项的类型无效(unicode v.dict)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过命令行将项目添加到DynamoDB表中,但是遇到类型错误.
I would like to add an item to my DynamoDB table via command line, but I've run into a type error.
我要添加的数据非常简单:
The data that I'm trying to add is very simple:
{
"id": "1"
}
我正在运行的命令同样简单:
The command I'm running is equally simple:
aws dynamodb put-item --table-name my_table --item '{ "id": "1" }'
我得到的错误是:
Invalid type for parameter Item.id, value: 1, type: <type 'unicode'>, valid types: <type 'dict'>
我来自JavaScript背景,所以我对 dict
类型不熟悉.从我从某些阅读的资料中了解到,这是Python吗?如何将数据更改为DynamoDB可以处理的数据?
I come from a JavaScript background, so I'm not familiar with dict
types. From what I understand from some of the sources I've read, this is a Python thing? How do I change my data into something that DynamoDB can handle?
推荐答案
您需要添加类型信息(我在这里假设为String)
you need to add the type information (I assume String here)
aws dynamodb put-item --table-name my_table --item '{ "id": {"S": "1" } }'
这篇关于通过CLI的AWS DynamoDB放置项的类型无效(unicode v.dict)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!