Bu konu, Tablestore SDK for Node.js kullanarak tablo yapılandırmalarının nasıl güncelleneceğini açıklar.
Ön koşullar
Yöntem açıklaması
updateTable: function describeTable(params, callback)
Not
updateTable()yöntemini çağırırken tableOptions değerini ayarlamanız gerekir.tableOptions değerini ayarlarken aşağıdaki parametrelerden en az birini ayarlamanız gerekir: timeToLive, maxVersions, maxTimeDeviation veya allowUpdate.
Örnek kod
Aşağıdaki örnek kod, test_table tablosunun yapılandırmalarını nasıl değiştireceğinizi gösterir.
var params = {
tableName: 'test_table',
tableOptions: {
// Set the TTL to 86400 seconds
timeToLive: 86400,
// Set the maximum number of versions
maxVersions: 3,
// Set the maximum version offset to 86400 seconds
maxTimeDeviation: 86400,
// Specify whether to allow updates
allowUpdate: false
},
// Set the reserved read throughput to 0 CUs and the reserved write throughput to 0 CUs (Only high-performance instances in CU mode support setting non-zero values for reserved read and write throughput)
reservedThroughput: {
capacityUnit: {
read: 0,
write: 0
}
},
// Enable Stream and set the Stream expiration time to 7 days
streamSpecification: {
enableStream: true,
expirationTime: 168
}
};
client.updateTable(params, function (err, data) {
if (err) {
console.error('error:', err);
return;
}
console.log('success:', data);
});