<bdo id='hRN9z'></bdo><ul id='hRN9z'></ul>

      <i id='hRN9z'><tr id='hRN9z'><dt id='hRN9z'><q id='hRN9z'><span id='hRN9z'><b id='hRN9z'><form id='hRN9z'><ins id='hRN9z'></ins><ul id='hRN9z'></ul><sub id='hRN9z'></sub></form><legend id='hRN9z'></legend><bdo id='hRN9z'><pre id='hRN9z'><center id='hRN9z'></center></pre></bdo></b><th id='hRN9z'></th></span></q></dt></tr></i><div id='hRN9z'><tfoot id='hRN9z'></tfoot><dl id='hRN9z'><fieldset id='hRN9z'></fieldset></dl></div>
    1. <tfoot id='hRN9z'></tfoot>

      1. <legend id='hRN9z'><style id='hRN9z'><dir id='hRN9z'><q id='hRN9z'></q></dir></style></legend>
      2. <small id='hRN9z'></small><noframes id='hRN9z'>

        如何将地图插入 DynamoDB 表?

        How do I insert a map into DynamoDB table?(如何将地图插入 DynamoDB 表?)

        <small id='4zean'></small><noframes id='4zean'>

        <i id='4zean'><tr id='4zean'><dt id='4zean'><q id='4zean'><span id='4zean'><b id='4zean'><form id='4zean'><ins id='4zean'></ins><ul id='4zean'></ul><sub id='4zean'></sub></form><legend id='4zean'></legend><bdo id='4zean'><pre id='4zean'><center id='4zean'></center></pre></bdo></b><th id='4zean'></th></span></q></dt></tr></i><div id='4zean'><tfoot id='4zean'></tfoot><dl id='4zean'><fieldset id='4zean'></fieldset></dl></div>
      3. <legend id='4zean'><style id='4zean'><dir id='4zean'><q id='4zean'></q></dir></style></legend>

            <tbody id='4zean'></tbody>
            <bdo id='4zean'></bdo><ul id='4zean'></ul>

            1. <tfoot id='4zean'></tfoot>
                  本文介绍了如何将地图插入 DynamoDB 表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有以下代码行:

                  table.put_item( Item={'filename' : key, 'status' : {'M' : iocheckdict }})
                  

                  iocheckdict 看起来像这样:

                  {'A': 'One', 'C': 'Three', 'D': 'Four', 'B': 'Two', 'E': 'Five'}
                  

                  所以,当我运行代码时,我得到了这个错误:

                  So, when I am running the code, I get this error:

                  An error occurred (ValidationException) when calling the PutItem operation: One or more parameter values were invalid: Type mismatch for key status expected: S actual: M
                  

                  即使我提到 M 作为数据的类型,为什么我会得到这个?

                  Why am I getting this, even though I mentioned M as the type of the data?

                  PS:我的表中有 2 列 filenamestatus

                  PS : I have 2 columns filename and status in my table

                  表的属性定义:

                  "AttributeDefinitions": [
                      {
                          "AttributeName": "filename",
                          "AttributeType": "S"
                      },
                      {
                          "AttributeName": "status",
                          "AttributeType": "S"
                      }
                  ],
                  

                  我知道status的类型是S,但是我在建表的时候没有找到map类型.我找到的只有 stringbinarynumber.

                  I understand that the type of status is S, but I haven't found the map type while creating the table. All I found are string, binary and number.

                  推荐答案

                  插入dynamodb的更简单方法

                  Easier way to insert into dynamodb

                  dynamodb = boto3.resource('dynamodb')
                  table = dynamodb.Table("table_name")
                  
                  item={}
                  item['filename'] = key
                  item['status'] = {'A': 'One', 'C': 'Three', 'D': 'Four', 'B': 'Two', 'E': 'Five'}
                  
                  table.put_item(Item=item)
                  

                  这篇关于如何将地图插入 DynamoDB 表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                  <i id='anHQn'><tr id='anHQn'><dt id='anHQn'><q id='anHQn'><span id='anHQn'><b id='anHQn'><form id='anHQn'><ins id='anHQn'></ins><ul id='anHQn'></ul><sub id='anHQn'></sub></form><legend id='anHQn'></legend><bdo id='anHQn'><pre id='anHQn'><center id='anHQn'></center></pre></bdo></b><th id='anHQn'></th></span></q></dt></tr></i><div id='anHQn'><tfoot id='anHQn'></tfoot><dl id='anHQn'><fieldset id='anHQn'></fieldset></dl></div>

                  • <tfoot id='anHQn'></tfoot>
                      <bdo id='anHQn'></bdo><ul id='anHQn'></ul>

                            <tbody id='anHQn'></tbody>

                          1. <legend id='anHQn'><style id='anHQn'><dir id='anHQn'><q id='anHQn'></q></dir></style></legend>

                            <small id='anHQn'></small><noframes id='anHQn'>