上载表的dynamo db的已下载json

时间:2018-08-08 11:12:19

标签: javascript node.js amazon-dynamodb

我已使用此脚本下载了远程dynamodb表。

https://github.com/bchew/dynamodump

我现在将数据保存在本地文件夹中,我想将此json上载到本地dynamo数据库。我正在使用的命令是这个。

sudo aws dynamodb put-item --table-name users --item file:///home/evbooth/Desktop/dynamo/table/dynamodump/dump/users/data/0001.json --endpoint-url http://localhost:8000

json的格式是这样的。

{
  "Count": 28,
  "Items": [
    {
      "userid": {
        "S": "chetankjain@gmail.com"
      },
      "password": {
        "S": "$2a$10$YoaOXLayZPnZOeWwd1zkpObs61pg/Qwjz78mKEFQs5Nla/iRoSsbm"
      },
      "role": {
        "S": "hr"
      }
    },
    {
      "userid": {
        "S": "call1test@gmail.com"
      },
      "password": {
        "S": "$2a$10$8NksGgORzDPgScWQ6Grs0Omk20ICUsA5xNPWWAhblrEWkA2tcFh1e"
      },
      "role": {
        "S": "candidate"
      }
    },
    {
      //
    }


  ],
  "ScannedCount": 28
}

但是它最终会变成这样的错误。

Parameter validation failed:
    Invalid type for parameter Item.Count, value: 28, type: <class 'int'>, valid types: <class 'dict'>
    Invalid type for parameter Item.Items, value: [OrderedDict([('userid', OrderedDict([('S', 'chetankjain@gmail.com')])), ('password', OrderedDict([('S', '$2a$10$YoaOXLayZPnZOeWwd1zkpObs61pg/Qwjz78mKEFQs5Nla/iRoSsbm')])), ('role', OrderedDict([('S', 'hr')]))]),....................('role', OrderedDict([('S', 'candidate')]))])], type: <class 'list'>, valid types: <class 'dict'>
Invalid type for parameter Item.ScannedCount, value: 28, type: <class 'int'>, valid types: <class 'dict'>

如何将这个查询上传给任何想法?

0 个答案:

没有答案