简体   繁体   English

dynamodb 在获取属性时遇到问题

[英]dynamodb getting issue on getting attributes

I want to get specific attributes(columns) in my dynamo query and getting error.我想在我的 dynamo 查询中获取特定属性(列)并出现错误。

    table = get_dynamodb_table()
    response = table.query(
        AttributesToGet=["USER_ID","NODE_TYPE"],
        IndexName='GSI3',
        KeyConditionExpression="GSI3_ACCOUNT_PK = 2 AND GSI3_UPDATED_ON BETWEEN 1231231 AND123")

but when I am trying to run this I am getting this error但是当我尝试运行它时,我收到了这个错误

botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the Query operation: Can not use both expression and non-expression parameters in the same request: Non-expression parameters: {AttributesToGet} Expression parameters: {KeyConditionExpression}

Try using ProjectionExpression instead.尝试改用ProjectionExpression As the docs at https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html explain, AttributesToGet is an older style and doesn't work in combo with newer expression features.正如https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html中的文档所解释的那样, AttributesToGet是一种较旧的样式,无法与较新的表达式功能结合使用。 That's what the error means.这就是错误的意思。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM