簡體   English   中英

如何在DynamoDB(Python)中的嵌套屬性上使用FilterExpression?

[英]How can i use FilterExpression over Nested Attributes in DynamoDB (Python)?

這是我的json模型:

item=item={"Company":"ABCD",
               "Industry":"Invest.Services",
               "Sector":"Financial",
               "Financial_Results":
                             [{"Date":"2007-03-31","Frequency":"Annual","REV1":"20","REV3":"33"},
                              {"Date":"2008-03-31","Frequency":"Annual","REV1":"20","REV3":"34.43"},
                              {"Date":"2012-03-31","Frequency":"Annual","REV1":"30","REV3":Decimal("230")},
                              {"Date":"2013-03-31","Frequency":"Quarterly","REV1":Decimal("30"),"REV3":"3.32"},
                              {"Date":"2013-06-31","Frequency":"Quarterly","REV1":Decimal("20"),"REV3":"-0.343"},
                              {"Date":"2013-09-31","Frequency":"Quarterly","REV1":"20.50","REV3":"-0.543"}]
             }
    table.put_item(Item=item)

item=item={"Company":"EFGH",
               "Industry":"Mining",
               "Sector":"Metals",
               "Financial_Results":
                             [{"Date":"2007-03-31","Frequency":"Annual","REV1":"20","REV3":"33"},
                              {"Date":"2008-03-31","Frequency":"Annual","REV1":"20","REV3":"34.43"},
                              {"Date":"2012-03-31","Frequency":"Annual","REV1":"30","REV3":Decimal("230")},
                              {"Date":"2013-03-31","Frequency":"Quarterly","REV1":Decimal("30"),"REV3":"3.32"},
                              {"Date":"2013-06-31","Frequency":"Quarterly","REV1":Decimal("20"),"REV3":"-0.343"},
                              {"Date":"2014-03-31","Frequency":"Annual","REV1":"20.50","REV3":"-0.543"}]
             }
    table.put_item(Item=item)

公司-分區鍵(哈希鍵)。

沒有范圍鍵(排序鍵)。

我的要求是:

  • 我該如何過濾'Date'屬性等於或大於'2013-03-31'和'REV1'屬性且僅包含少於零個項目。

注意:我已經引用了以下鏈接http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Attributes.html#DocumentPaths

我仍然沒有任何結論。請幫助我。 提前致謝

經過一整天的研發,我終於找到了答案。 根據AWS DynamoDB文檔和其他重要研究,我得出結論,目前不支持我的json模型准備(在頂部) 。根據我的要求,我需要整理數據而不是文檔基礎。盡管如此,感謝每個貢獻者。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM