久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='VWpQc'></tfoot>

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

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

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

        Dynamodb:使用兩個以上屬性進行查詢

        Dynamodb: query using more than two attributes(Dynamodb:使用兩個以上屬性進行查詢)

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

              • <small id='UqTWt'></small><noframes id='UqTWt'>

                  <bdo id='UqTWt'></bdo><ul id='UqTWt'></ul>
                • 本文介紹了Dynamodb:使用兩個以上屬性進行查詢的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  在 Dynamodb 中,您需要在索引中指定可用于進行查詢的屬性.

                  In Dynamodb you need to specify in an index the attributes that can be used for making queries.

                  如何使用兩個以上的屬性進行查詢?

                  How can I make a query using more than two attributes?

                  使用 boto 的示例.

                  Example using boto.

                  Table.create('users', 
                          schema=[
                              HashKey('id') # defaults to STRING data_type
                          ], throughput={
                              'read': 5,
                              'write': 15,
                          }, global_indexes=[
                              GlobalAllIndex('FirstnameTimeIndex', parts=[
                                  HashKey('first_name'),
                                  RangeKey('creation_date', data_type=NUMBER),
                              ],
                              throughput={
                                  'read': 1,
                                  'write': 1,
                              }),
                              GlobalAllIndex('LastnameTimeIndex', parts=[
                                  HashKey('last_name'),
                                  RangeKey('creation_date', data_type=NUMBER),
                              ],
                              throughput={
                                  'read': 1,
                                  'write': 1,
                              })
                          ],
                          connection=conn)
                  

                  如何使用 boto 查找名字為John"、姓氏為Doe"并在2015 年 3 月 21 日"創建的用戶?

                  How can I look for users with first name 'John', last name 'Doe', and created on '3-21-2015' using boto?

                  推薦答案

                  您的數據建模過程必須考慮您的數據檢索要求,在 DynamoDB 中您只能通過哈希或哈希 + 范圍鍵進行查詢.

                  Your data modeling process has to take into consideration your data retrieval requirements, in DynamoDB you can only query by hash or hash + range key.

                  如果按主鍵查詢不足以滿足您的要求,您當然可以通過創建二級索引(本地或全局)來獲得備用鍵.

                  If querying by primary key is not enough for your requirements, you can certainly have alternate keys by creating secondary indexes (Local or Global).

                  但是,在某些情況下,可以將多個屬性的串聯用作您的主鍵,以避免維護二級索引的成本.

                  However, the concatenation of multiple attributes can be used in certain scenarios as your primary key to avoid the cost of maintaining secondary indexes.

                  如果您需要通過名字、姓氏和創建日期來獲取用戶,我建議您將這些屬性包含在 Hash 和 Range Key 中,這樣就不需要創建額外的索引.

                  If you need to get users by First Name, Last Name and Creation Date, I would suggest you to include those attributes in the Hash and Range Key, so the creation of additional indexes are not needed.

                  哈希鍵應該包含一個可以由您的應用程序計算的值,同時提供統一的數據訪問.例如,假設您選擇如下定義密鑰:

                  The Hash Key should contain a value that could be computed by your application and at same time provides uniform data access. For example, say that you choose to define your keys as follow:

                  哈希鍵(名稱):first_name#last_name

                  Hash Key (name): first_name#last_name

                  范圍鍵(已創建):MM-DD-YYYY-HH-mm-SS-毫秒

                  Range Key (created) : MM-DD-YYYY-HH-mm-SS-milliseconds

                  您始終可以附加其他屬性,以防提及的屬性不足以使您的鍵在整個表中唯一.

                  users = Table.create('users', schema=[
                          HashKey('name'),
                          RangeKey('created'),
                       ], throughput={
                          'read': 5,
                          'write': 15,
                       })
                  

                  將用戶添加到表中:

                  with users.batch_write() as batch:
                       batch.put_item(data={
                           'name': 'John#Doe',
                           'first_name': 'John',
                           'last_name': 'Doe',
                           'created': '03-21-2015-03-03-02-3243',
                       })
                  

                  您在2015 年 3 月 21 日"創建的用于查找用戶 John Doe 的代碼應類似于:

                  Your code to find the user John Doe, created on '03-21-2015' should be something like:

                  name_john_doe = users.query_2(
                     name__eq='John#Doe',
                     created__beginswith='03-21-2015'
                  )
                  
                  for user in name_john_doe:
                       print user['first_name']
                  

                  重要注意事項:

                  我.如果您的查詢開始變得過于復雜,并且由于連接字段過多而導致哈希或范圍鍵過長,那么一定要使用二級索引.這是一個好兆頭,僅主索引不足以滿足您的要求.

                  i. If your query starts to get too complicated and the Hash or Range Key too long by having too many concatenated fields then definitely use Secondary Indexes. That's a good sign that only a primary index is not enough for your requirements.

                  二.我提到哈希鍵應該提供統一的數據訪問:

                  ii. I mentioned that the Hash Key should provide uniform data access:

                  "Dynamo 使用一致的散列將其鍵空間劃分為副本并確保均勻的負載分布.統一的鑰匙分布可以幫助我們實現均勻的負載分布,假設密鑰的訪問分布沒有高度傾斜." [DYN]

                  "Dynamo uses consistent hashing to partition its key space across its replicas and to ensure uniform load distribution. A uniform key distribution can help us achieve uniform load distribution assuming the access distribution of keys is not highly skewed." [DYN]

                  Hash Key 不僅可以唯一標識記錄,而且是保證負載分配的機制.Range Key(使用時)有助于指示將大部分一起檢索的記錄,因此,也可以針對這種需要優化存儲.

                  Not only the Hash Key allows to uniquely identify the record, but also is the mechanism to ensure load distribution. The Range Key (when used) helps to indicate the records that will be mostly retrieved together, therefore, the storage can also be optimized for such need.

                  下面的鏈接對這個話題有完整的解釋:

                  The link below has a complete explanation about the topic:

                  http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForTables.html#GuidelinesForTables.UniformWorkload

                  這篇關于Dynamodb:使用兩個以上屬性進行查詢的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發帶有已編譯動態共享庫的 Python 包)
                    • <bdo id='0WEi7'></bdo><ul id='0WEi7'></ul>

                          <tbody id='0WEi7'></tbody>
                        <legend id='0WEi7'><style id='0WEi7'><dir id='0WEi7'><q id='0WEi7'></q></dir></style></legend>

                      1. <small id='0WEi7'></small><noframes id='0WEi7'>

                          <i id='0WEi7'><tr id='0WEi7'><dt id='0WEi7'><q id='0WEi7'><span id='0WEi7'><b id='0WEi7'><form id='0WEi7'><ins id='0WEi7'></ins><ul id='0WEi7'></ul><sub id='0WEi7'></sub></form><legend id='0WEi7'></legend><bdo id='0WEi7'><pre id='0WEi7'><center id='0WEi7'></center></pre></bdo></b><th id='0WEi7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0WEi7'><tfoot id='0WEi7'></tfoot><dl id='0WEi7'><fieldset id='0WEi7'></fieldset></dl></div>
                            <tfoot id='0WEi7'></tfoot>
                          • 主站蜘蛛池模板: 日本黄色不卡视频 | 玖玖免费 | 成人三级电影 | 日本一区二区三区四区 | 国产精品久久久久久吹潮日韩动画 | 一区二区三区av夏目彩春 | 九九热这里 | 香蕉婷婷 | 祝你幸福电影在线观看 | 91久操视频| 日日摸夜夜添夜夜添特色大片 | 欧美激情久久久 | 欧美日韩国产精品一区 | 91久久精品一区二区二区 | 亚洲国产一区在线 | 国产精品国产精品国产专区不片 | 狠狠久久综合 | 中午字幕在线观看 | 亚洲一区二区三区在线观看免费 | 风间由美一区二区三区在线观看 | 成人黄色a | 国产国语精品 | 国产一二区免费视频 | 亚洲国产精品成人 | 亚洲一一在线 | 在线免费小视频 | 久久国际精品 | 欧美黑人一级爽快片淫片高清 | 久久综合伊人 | 午夜a级理论片915影院 | 麻豆a级片 | 国产免费a视频 | 91精品国产综合久久精品 | 日韩欧美视频 | 久久久精品网站 | 久久久精品综合 | 久久国产欧美日韩精品 | 不卡一二区 | 色永久| 日韩欧美操 | 黄色在线免费观看 |