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

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

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

      1. 检查 DynamoDB 中是否存在表的最佳方法是什么?

        时间:2024-05-10

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

            <tfoot id='9zvfh'></tfoot>
              <tbody id='9zvfh'></tbody>

            <small id='9zvfh'></small><noframes id='9zvfh'>

              <legend id='9zvfh'><style id='9zvfh'><dir id='9zvfh'><q id='9zvfh'></q></dir></style></legend>

                • <bdo id='9zvfh'></bdo><ul id='9zvfh'></ul>
                  本文介绍了检查 DynamoDB 中是否存在表的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  检查 DynamoDb 中是否存在表的最佳方法是什么?

                  What is the best way to check if table exists in DynamoDb?

                  如果代码在 PHP 中,我将不胜感激.

                  I would appreciate it if the code would be in PHP.

                  无论是否活跃.

                  * 稍后作为示例添加到错误代码 400 的各种情况

                  * Added later as an example to various cases for error code 400

                  检查表是否存在很容易,它可以有以下之一TableStatus => 正在创建、活动、删除或更新

                  It's very easy to check if the table exist, it can have one of the following TableStatus => CREATING, ACTIVE, DELETING or UPDATING

                  但如果我收到错误 400,它可能意味着不止一件事.

                  but in case i get error 400 it can mean more than one thing.

                  1) 错误地将空字符串作为表名发送.

                  1) sent null string as a table name by mistake.

                  [x-aws-body] => {"TableName":""})

                  [x-aws-body] => {"TableName":""} )

                  [body] => CFSimpleXML Object
                      (
                          [__type] => com.amazon.coral.validate#ValidationException
                          [message] => The paramater 'tableName' must be at least 3 characters long and at most 255 characters long
                      )
                  
                  [status] => 400
                  

                  2) 发送到 DynamoDB 的命令中存在语法错误,例如写入 table_name 而不是 table_name.

                  2) syntax error in the command sent to DynamoDB, for example writting tabel_name instead of table_name.

                  [x-aws-body] => {"TabelName":"test7"})

                  [x-aws-body] => {"TabelName":"test7"} )

                  [body] => CFSimpleXML Object
                      (
                          [__type] => com.amazon.coral.validate#ValidationException
                          [message] => The paramater 'tableName' is required but was not present in the request
                      )
                  
                  [status] => 400
                  

                  3) 我会猜测但没有检查,如果我同时超过了桌子上的预置容量.

                  3) I would guess but didn't check, if I exceed at that same time the provisioned capacity on the table.

                  推荐答案

                  你可以看看官方PHP SDK的describe_table".400 表示不存在" 官方文档中有一个相当广泛的示例.看看它在删除"示例中是如何使用的,就在底部.

                  You can have a look at "describe_table" of the official PHP SDK. 400 means "does not exist" There is a pretty extensive example in the official documentation. Look at how it is used in the "delete" example, right at the bottom.

                  http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/LowLevelPHPTableOperationsExample.html

                  这是文档中的(剥离的)示例

                  Here is the (stripped) example from the doc

                  <?php
                  require_once dirname(__FILE__) . '/sdk/sdk.class.php';
                  
                  $dynamodb = new AmazonDynamoDB();
                  $table_name = 'ExampleTable';
                  $response = $dynamodb->describe_table(array('TableName' => $table_name));
                  
                  if((integer) $response->status !== 400)
                  {
                      $error_type = $response->body->__type;
                      $error_code = explode('#', $error_type)[1];
                      if($error_code == 'ResourceNotFoundException')
                      {
                          echo "Table ".$table_name." exists.";
                      }
                  }
                  ?>
                  

                  这篇关于检查 DynamoDB 中是否存在表的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:写入 Amazon DynamoDB (PHP API) 的速度非常慢 下一篇:如何检查dynamodb中的字符串集中是否存在字符串

                  相关文章

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

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

                    1. <tfoot id='WAnrK'></tfoot>

                      <legend id='WAnrK'><style id='WAnrK'><dir id='WAnrK'><q id='WAnrK'></q></dir></style></legend>

                      • <bdo id='WAnrK'></bdo><ul id='WAnrK'></ul>