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

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

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

        <tfoot id='Cv5Av'></tfoot>

        <i id='Cv5Av'><tr id='Cv5Av'><dt id='Cv5Av'><q id='Cv5Av'><span id='Cv5Av'><b id='Cv5Av'><form id='Cv5Av'><ins id='Cv5Av'></ins><ul id='Cv5Av'></ul><sub id='Cv5Av'></sub></form><legend id='Cv5Av'></legend><bdo id='Cv5Av'><pre id='Cv5Av'><center id='Cv5Av'></center></pre></bdo></b><th id='Cv5Av'></th></span></q></dt></tr></i><div id='Cv5Av'><tfoot id='Cv5Av'></tfoot><dl id='Cv5Av'><fieldset id='Cv5Av'></fieldset></dl></div>
      1. 通过python的dynamodb行数,boto查询

        dynamodb row count via python, boto query(通过python的dynamodb行数,boto查询)
        <legend id='kBeP3'><style id='kBeP3'><dir id='kBeP3'><q id='kBeP3'></q></dir></style></legend>

            <tbody id='kBeP3'></tbody>
            <bdo id='kBeP3'></bdo><ul id='kBeP3'></ul>

            1. <small id='kBeP3'></small><noframes id='kBeP3'>

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

                  本文介绍了通过python的dynamodb行数,boto查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  各位,我正在尝试让以下代码工作以返回表中的行数:

                  Folks, Am trying to get the following bit of code working to return the row count in a table:

                  import boto
                  import boto.dynamodb2
                  from boto.dynamodb2.table import Table
                  from boto.dynamodb2.fields import HashKey, RangeKey
                  
                  drivers = Table('current_fhv_drivers')
                  rowcountquery = drivers.query(
                     number = 'blah',
                     expiration = 'foo',
                     count=True,
                    )
                  for x in rowcountquery:
                   print x['Count']
                  

                  我看到的错误是:

                  boto.dynamodb2.exceptions.UnknownFilterTypeError: Operator 'count' from 'count' is not recognized.
                  

                  获取行数的正确语法是什么:)

                  Whats the correct syntaxt to get row count :)

                  谢谢!

                  推荐答案

                  那个异常基本上是在告诉你操作符'count'不被boto识别.

                  That exception is basically telling you that the operator 'count' is not recognized by boto.

                  如果您阅读 http://boto.readthedocs.org 上的第二段/en/latest/dynamodb2_tut.html#querying 你会看到:

                  If you read the second paragraph on http://boto.readthedocs.org/en/latest/dynamodb2_tut.html#querying you'll see that:

                  过滤器参数作为 kwargs &使用 __ 将字段名与用于过滤值的运算符分开.

                  Filter parameters are passed as kwargs & use a __ to separate the fieldname from the operator being used to filter the value.

                  所以我会将您的代码更改为:

                  So I would change your code to:

                  import boto
                  import boto.dynamodb2
                  from boto.dynamodb2.table import Table
                  from boto.dynamodb2.fields import HashKey, RangeKey
                  
                  drivers = Table('current_fhv_drivers')
                  rowcountquery = drivers.query(
                     number__eq = 'blah',
                     expiration__eq = 'foo',
                     count__eq = True,
                    )
                  for x in rowcountquery:
                   print x['Count']
                  

                  这篇关于通过python的dynamodb行数,boto查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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% 就足够了)
                • <small id='ftf32'></small><noframes id='ftf32'>

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

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

                          <tbody id='ftf32'></tbody>
                        • <bdo id='ftf32'></bdo><ul id='ftf32'></ul>