You can call the DeleteTable operation to delete a data table from an instance.
Usage notes
You cannot restore deleted data tables. Proceed with caution.
When you delete a data table, the data in the data table and the secondary indexes that are created for the data table are deleted. You cannot restore deleted data or secondary indexes. Proceed with caution.
Prerequisites
An OTSClient instance is initialized. For more information, see Initialize an OTSClient instance.
A data table is created. For more information, see Create a data table.
If a search index is created for the data table that you want to delete, you must delete the search index before you delete the data table. For more information, see Delete search indexes.
API operation
/**
* Delete a specific table from the instance.
*/
deleteTable(params, callback)
Parameters
Parameter | Description |
tableName | The name of the data table. |
Example
The following sample code provides an example on how to delete a data table:
var client = require('./client');
var params = {
tableName: 'sampleTable'
};
client.deleteTable(params, function (err, data) {
if (err) {
console.log('error:', err);
return;
}
console.log('success:', data);
});
References
For more information about the API operation, see DeleteTable. For the complete sample code, visit DeleteTable@GitHub.
If an error occurs when you call this operation, search for the error cause in Error codes based on the error message and troubleshoot the error.