查询全局二级索引:'MissingRequiredParameter:缺少必需的键

我有一个像这样的DynamoDB表定义:


import PySimpleGUI as sg
# All the stuff inside your window.
layout [
         [sg.Image(data=image1,key='__IMAGE__',size=(5,6))]
       ]

# Create the Window
window = sg.Window('Window Title',layout)

# Event Loop to process "events" and get the "values" of the inputs
while True:
    event,values = window.read()
    if event in (None,'Cancel'):   # if user closes window or clicks cancel
        break

    window.Element('_IMAGE_').Update(data=image2)

window.close()

其中“ pk”是分区密钥。而“ sk”是排序键。如果您想知道为什么pk和sk都具有相同的值:Adjacency List Design Pattern

我已在“索引”属性上创建了全局二级索引。它的投影都是pk和sk键。

查询全局二级索引:'MissingRequiredParameter:缺少必需的键

现在,following the documentation我正在这样查询我的GSI:

{
"pk": {
  "S": "00000000-0000-0000-0000-000000000001"
},"sk": {
  "S": "00000000-0000-0000-0000-000000000001"
},"year": {
  "N": "2019"
}
"index": {
  "N": "987654321"
}
}

我收到以下错误消息:'MissingRequiredParameter:在参数中缺少必需的键\'Key \'\ n

以防万一,我在Lambda中使用Node.js 8.10

sanhewangluo 回答:查询全局二级索引:'MissingRequiredParameter:缺少必需的键

通常,GSI可以具有相同GSI主键+辅助键组合的多个条目。结果,您无法使用UIView调用来检索对象。针对GSI的查询必须为getItem()scan

Amazon关于working with GSIs

的文档的前几行中提到了这一点。
本文链接:https://www.f2er.com/3150683.html

大家都在问