简体   繁体   中英

dynamo db error Invalid ProjectionExpression: An expression attribute name used in the document path is not defined; attribute name: #P

I am trying to get and delete the data from dynamo db using some 2 primary key column, In which one is reserved keyword timestamp .

When I get data using one of the primary key then it is working fine, But when I trying to delete using two primary key field in projection expression it giving me an error like :

ValidationException: Invalid ProjectionExpression: An expression attribute name used in the document path is not defined; attribute name: #P

And this is my params object

{ TableName: 'Log', ProjectionExpression: 'username, #P', ExpressionAttributeNames: { '#P': 'timestamp' }, ExpressionAttributeValues: null }

username and timestamp are primary key columns.

This thing is not working in only this table. In some others table I have same situation but it will not throwing me this error. Only in this case I am getting the error.

The DeleteItem API does not allow you to specify a ProjectionExpression. You can get the entire pre-deletion image of the item by selecting ReturnValues = ALL_OLD .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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