Search in sources :

Example 1 with UpdateDatabaseRequest

use of com.amazonaws.services.glue.model.UpdateDatabaseRequest in project presto by prestodb.

the class GlueHiveMetastore method renameDatabase.

@Override
public void renameDatabase(MetastoreContext metastoreContext, String databaseName, String newDatabaseName) {
    try {
        Database database = getDatabase(metastoreContext, databaseName).orElseThrow(() -> new SchemaNotFoundException(databaseName));
        DatabaseInput renamedDatabase = GlueInputConverter.convertDatabase(database).withName(newDatabaseName);
        stats.getUpdateDatabase().record(() -> glueClient.updateDatabase(new UpdateDatabaseRequest().withCatalogId(catalogId).withName(databaseName).withDatabaseInput(renamedDatabase)));
    } catch (AmazonServiceException e) {
        throw new PrestoException(HIVE_METASTORE_ERROR, e);
    }
}
Also used : UpdateDatabaseRequest(com.amazonaws.services.glue.model.UpdateDatabaseRequest) Database(com.facebook.presto.hive.metastore.Database) AmazonServiceException(com.amazonaws.AmazonServiceException) DatabaseInput(com.amazonaws.services.glue.model.DatabaseInput) PrestoException(com.facebook.presto.spi.PrestoException) SchemaNotFoundException(com.facebook.presto.spi.SchemaNotFoundException)

Aggregations

AmazonServiceException (com.amazonaws.AmazonServiceException)1 DatabaseInput (com.amazonaws.services.glue.model.DatabaseInput)1 UpdateDatabaseRequest (com.amazonaws.services.glue.model.UpdateDatabaseRequest)1 Database (com.facebook.presto.hive.metastore.Database)1 PrestoException (com.facebook.presto.spi.PrestoException)1 SchemaNotFoundException (com.facebook.presto.spi.SchemaNotFoundException)1