AWS Dynamodb boto3 batch_get_item ProjectionExpression 不起作用

Nav*_*ish 3 amazon-dynamodb

使用 Boto3 Python 库,对于下面的代码块,在使用 时ProjectionExpression,我收到一个错误Requested resource not found。

当我不使用时ProjectionExpression,它可以工作但会带来所有列。

sellerDict = dynamodb.batch_get_item(
    RequestItems={'Seller':
                   {'Keys': vq},
                   'ProjectionExpression': {
                   'Keys': [{'MobileNo': 'N'}, 
                            {'Offer': 'N'}]
                    }
                  }
)
Run Code Online (Sandbox Code Playgroud)

not*_*est 5

本ProjectionExpression应该是属性的字符串。在下面的例子中,yearkey是一个数字属性,title是一个字符串属性,info是一个地图属性。我刚刚rating从info地图中投影了属性。

RequestItems={
    'Movies': {
        'Keys': [
            {
                'yearkey': 2012,
                'title' : 'The Big New Movie 2012'
            },
        ],            
        'ConsistentRead': True,
        'ProjectionExpression': 'yearkey, title, info.rating'            
    }
},
Run Code Online (Sandbox Code Playgroud)