1. <legend id='NSFKk'><style id='NSFKk'><dir id='NSFKk'><q id='NSFKk'></q></dir></style></legend>
      <bdo id='NSFKk'></bdo><ul id='NSFKk'></ul>

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

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

    2. 使用 Boto 在 Amazon DynamoDB 中进行分页

      时间:2023-07-05
            <tbody id='QSRkr'></tbody>

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

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

            <tfoot id='QSRkr'></tfoot>
              <bdo id='QSRkr'></bdo><ul id='QSRkr'></ul>
                <legend id='QSRkr'><style id='QSRkr'><dir id='QSRkr'><q id='QSRkr'></q></dir></style></legend>
                本文介绍了使用 Boto 在 Amazon DynamoDB 中进行分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何使用 Boto python 库对来自 DynamoDB 的结果进行分页?从 Boto API 文档中,我无法确定它是否支持分页,尽管 DynamoDB API 确实支持分页.

                How do I paginate my results from DynamoDB using the Boto python library? From the Boto API documentation, I can't figure out if it even has support for pagination, although the DynamoDB API does have pagination support.

                推荐答案

                Boto 确实支持使用ExclusiveStartKey"和Limit"组合的分页"行为.例如,对 Scan 进行分页.

                Boto does have support for "pagination" like behavior using a combination of "ExclusiveStartKey" and "Limit". For example, to paginate Scan.

                这是一个应该按 10 个块解析整个表的示例

                Here is an example that should parse a whole table by chunks of 10

                esk = None
                
                while True:
                    # load this batch
                    scan_generator = MyTable.scan(max_results=10, exclusive_start_key=esk)
                
                    # do something usefull
                    for item in scan_generator:
                        pass  # do something usefull
                    # are we done yet ?
                    else:
                        break;
                
                    # Load the last keys
                    esk = scan_generator.kwargs['exclusive_start_key'].values()
                

                正如@garnaat 所指出的,我可能误解了您的实际目标.上述建议允许您提供分页,例如 SO 对问题所做的那样.每页不超过 15 个.

                As pointed out by @garnaat, it is possible that I misunderstood your actual goal. The above suggestion allows you to provide pagination like SO does for questions for example. No more than 15 per pages.

                如果您只需要一种方法来加载由给定 Scan 生成的整个结果集,Boto 是一个很棒的库,并且已经为您抽象了它,而无需像我的回答中那样使用黑魔法.在这种情况下,您应该遵循他 (@garnaat) 的建议.顺便说一句,他是 Boto 的作者,因此是 Boto 相关问题的一个很好的参考:)

                If you just need a way to load the whole result set produced by a given Scan, Boto is a great library and already abstracts this for you with no need for black magic like in my answer. In this case, you should follow what he (@garnaat) advises. Btw, he is the author of Boto and, as such, a great reference for Boto related questions :)

                这篇关于使用 Boto 在 Amazon DynamoDB 中进行分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:是否可以将日期时间保存到 DynamoDB? 下一篇:Amazon 的 Alexa Skill Kit (ASK) Lambda 交互故障排除

                相关文章

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

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

                  • <bdo id='JADaC'></bdo><ul id='JADaC'></ul>
                2. <tfoot id='JADaC'></tfoot>