我如何在 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)
公司 - 分区键(哈希键)。
无范围键(排序键)。
我的要求是:
- 我如何过滤等于或大于“2013-03-31”的 'Date' 属性和仅小于零项的 'REV1' 属性。
注意:
我参考了以下 link
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Attributes.html#DocumentPaths
我仍然没有得到任何 conclusions.Kindly 帮助。提前致谢
研发了一天终于找到答案了。 根据 AWS DynamoDB 文档和其他认真的研究,我得出结论,我的 json 模型准备(顶部)目前不受支持。根据我的要求,我需要展平我的数据而不是每个贡献者的文档 basis.Thanks。
这是我的 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)
公司 - 分区键(哈希键)。
无范围键(排序键)。
我的要求是:
- 我如何过滤等于或大于“2013-03-31”的 'Date' 属性和仅小于零项的 'REV1' 属性。
注意: 我参考了以下 link http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Attributes.html#DocumentPaths
我仍然没有得到任何 conclusions.Kindly 帮助。提前致谢
研发了一天终于找到答案了。 根据 AWS DynamoDB 文档和其他认真的研究,我得出结论,我的 json 模型准备(顶部)目前不受支持。根据我的要求,我需要展平我的数据而不是每个贡献者的文档 basis.Thanks。