AWS DynamoDB put-item 通过 CLI 的类型无效(unicode v. dict) [英] Invalid type for AWS DynamoDB put-item via CLI (unicode v. dict)

查看:19
本文介绍了AWS DynamoDB put-item 通过 CLI 的类型无效(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" } }'

这篇关于AWS DynamoDB put-item 通过 CLI 的类型无效(unicode v. dict)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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