繁体   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