2017-07-17 17 views
0

這裏是我的JSON模式:如何在DynamoDB(Python)中使用FilterExpression over Nested Attributes?

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年3月31日」和「REV1」只有小於零組的項目屬性更多。

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

我仍然沒有得到任何conclusions.Kindly幫助我。在此先感謝

+0

你好,歡迎來到Stack Overflow,請花點時間閱讀[歡迎導覽](https://stackoverflow.com/tour)以瞭解你在這裏的方式(並獲得你的第一張徽章),閱讀如何創建[mcve]示例並檢查[問],以便增加獲得反饋和有用答案的機會。 – garfbradaz

+0

只是它不可能,因爲它是一個對象列表。 – notionquest

+0

@notionquest感謝您的寶貴回覆。但是,有沒有其他方法可以像上面提到的那樣獲得相同的功能。 –

回答

0

Atlast我發現R & D一整天后答案。 根據AWS DynamoDB文檔和其他嚴肅的研究,我得出結論,我的json模型準備(頂部)目前不支持。根據我的要求,我需要扁平化我的數據而不是文檔basis.Thanks每個貢獻者雖然。

相關問題