Altering JSON Tables with the MapR-DB OJAI Java API Library

Change the values of table attributes by using a TableDescriptor object and then passing that object to the Admin interface's altertable() method.

In this example, the code turns off the bulkload flag on the table. Applications will typically need to turn off this flag after a bulk load of the table with the import, importJSON, or copytable utility.

Create a TableDescriptor object for an existing table by passing the path of the table to the Admin interface's getTableDescriptor() method.

Example

  public void alterTable(String tablePath) throws DBException {
    try (Admin admin = MapRDB.newAdmin()) {
      TableDescriptor tableDesc = admin.getTableDescriptor(tablePath);
      // set bulk load to false
      tableDesc.setBulkLoad(false);
      admin.alterTable(tableDesc).close();
    }
  }

Permissions Required

The readAce and writeAce permissions on the volumes where the JSON tables are located. For information about how to set permissions on volumes, see Setting/Modifying Whole Volume ACEs.