本文介绍如何通过 Node.js SDK 更新表的配置信息。
前提条件
方法说明
updateTable: function describeTable(params, callback)
说明
调用
updateTable()
方法时,必须设置tableOptions。设置 tableOptions 时,必须设置timeToLive、maxVersions、maxTimeDeviation、allowUpdate中的至少一项。
示例代码
以下示例代码用于修改test_table表的配置信息。
var params = {
tableName: 'test_table',
tableOptions: {
// 设置数据生命周期,单位为秒
timeToLive: 86400,
// 设置最大版本数
maxVersions: 3,
// 设置有效版本偏差,单位为秒
maxTimeDeviation: 86400,
// 设置是否允许更新
allowUpdate: false
},
// 设置预留读为0CU,预留写为0CU(仅CU模式高性能实例支持设置数据表的预留读写吞吐量为非零值)
reservedThroughput: {
capacityUnit: {
read: 0,
write: 0
}
},
// 开启Stream信息,并设置Stream过期时间为7天
streamSpecification: {
enableStream: true,
expirationTime: 168
}
};
client.updateTable(params, function (err, data) {
if (err) {
console.error('error:', err);
return;
}
console.log('success:', data);
});
该文章对您有帮助吗?