简体   繁体   中英

How to remove attribute from item in DynamoDB table?

I have an item whose particular attribute I want to remove using SDK 2.x from DynamoDB. How do I do this? I am using enhanced DynamoDB for table management. Here's a code sample:

DynamoDbTable<T> mappedTable = AwsConfig.getTableSchema(schema, clazz);
T updatedRecord = mappedTable.updateItem(request -> {
                request.ignoreNulls(true);
                request.item(record);
});

I would appreciate a solution using enhanced DynamoDB client.

Not sure what you mean by remove attribute, if you refer to not have an attribute persisted in dynamoDB you can use @DynamoDbIgnore

@DynamoDbBean
public class SomeDynamoDBEntity {

    @DynamoDbIgnore
    public String getType() {
        return this.type;
    }
}

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