TableRequest APIの使用による索引の削除

TableRequest APIを使用して、NoSQL表の索引を削除できます。

TableRequestクラスで指定された操作の実行は非同期です。これらは、長時間実行される可能性がある操作です。TableResultは、TableRequest操作から返され、表の状態をカプセル化します。TableRequestクラスおよびそのメソッドの詳細は、Oracle NoSQL Java SDK APIリファレンスを参照してください。

こちらにあるサンプルの中からフル・コードIndexes.javaをダウンロードします。
/* Drop the index acct_episodes*/
private static void dropIndex(NoSQLHandle handle) throws Exception {
   String dropIndexDDL = "DROP INDEX acct_episodes ON " + tableName;
   TableRequest treq = new TableRequest().setStatement(dropIndexDDL);
   TableResult tres = handle.tableRequest(treq);
   tres.waitForCompletion(handle, 60000, /* wait 60 sec */
            1000); /* delay ms for poll */
   System.out.println("Index acct_episodes on " + tableName + " is dropped");
}

borneo.TableRequestクラスを使用して表索引を削除できます。borneo.NoSQLHandle.table_request()へのすべてのコールは非同期であるため、結果を確認し、borneo.TableResult.wait_for_completion()をコールして操作が完了するまで待機する必要があります。table_requestとそのメソッドの詳細は、Oracle NoSQL Python SDK APIリファレンスを参照してください。

こちらにあるサンプルの中からフル・コードIndexes.py をダウンロードします。
#drop the index
def drop_index(handle):
   statement = '''DROP INDEX acct_episodes ON stream_acct'''
   request = TableRequest().set_statement(statement)
   table_result = handle.do_table_request(request, 40000, 3000)
   table_result.wait_for_completion(handle, 40000, 3000)
   print('Index acct_episodes on the table stream_acct is dropped')

TableRequestクラスを使用して表索引を削除できます。TableRequestで指定された操作の実行は非同期です。これらは、長時間実行される可能性がある操作です。このリクエストは、Client.DoTableRequest()操作の入力として使用されます。これにより、表が目的の状態に達するまでポーリングするために使用できる、TableResultが返されます。TableRequestクラスの様々なメソッドの詳細は、Oracle NoSQL Go SDK APIリファレンスを参照してください。

こちらにあるサンプルの中からフル・コードIndexes.goをダウンロードします。
//drops an index from a table
func dropIndex(client *nosqldb.Client, err error, tableName string)(){
   stmt := fmt.Sprintf("DROP INDEX acct_episodes ON %s",tableName)
   tableReq := &nosqldb.TableRequest{
		Statement: stmt,
   }
   tableRes, err := client.DoTableRequest(tableReq)
   if err != nil {
      fmt.Printf("cannot initiate DROP INDEX request: %v\n", err)
      return
   }
   // The drop index request is asynchronous, wait for drop index to complete.
   _, err = tableRes.WaitForCompletion(client, 60*time.Second, time.Second)
   if err != nil {
      fmt.Printf("Error finishing DROP INDEX request: %v\n", err)
      return
   }
   fmt.Println("Dropped index acct_episodes on table ", tableName)
   return
}

tableDDLメソッドを使用して表索引を削除できます。このメソッドは非同期です。このメソッドでは、TableResultのPromiseが返されます。TableResultは、DDL操作のステータス(そのTableState、名前、スキーマ、そのTableLimitsなど)を含むプレーンなJavaScriptオブジェクトです。メソッドの詳細は、NoSQLClientクラスを参照してください。

こちらにあるサンプルの中からJavaScriptフル・コードIndexes.jsを、こちらにあるサンプルの中からTypeScriptフル・コードIndexes.tsをダウンロードします。
//drops an index
async function dropIndex(handle) {
   const dropindDDL = `DROP INDEX acct_episodes ON ${TABLE_NAME}`;
   let res =  await handle.tableDDL(dropindDDL);
   console.log('Index acct_episodes is dropped from table: ' + TABLE_NAME);
}

ExecuteTableDDLAsyncまたはExecuteTableDDLWithCompletionAsyncメソッドを使用して表索引を削除できます。どちらのメソッドでも、Task<TableResult>が返されます。TableResultインスタンスには、DDL操作のステータス(TableStateや表スキーマなど)が含まれます。これらのメソッドの詳細は、Oracle NoSQL Dotnet SDK APIリファレンスを参照してください。

こちらにあるサンプルの中からフル・コードIndexes.csをダウンロードします。
private static async Task dropIndex(NoSQLClient client){
   var sql = $@"DROP INDEX acct_episodes on {TableName}";
   var tableResult = await client.ExecuteTableDDLAsync(sql);
   // Wait for the operation completion
   await tableResult.WaitForCompletionAsync();
   Console.WriteLine(" Index acct_episodes is dropped from table Table {0}",
                tableResult.TableName);
}