use of com.amazonaws.services.glue.model.Database in project alluxio by Alluxio.
the class GlueDatabase method getDatabaseInfo.
@Override
public DatabaseInfo getDatabaseInfo() throws IOException {
try {
GetDatabaseRequest dbRequest = new GetDatabaseRequest().withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)).withName(mGlueDbName);
GetDatabaseResult dbResult = mGlueClient.getDatabase(dbRequest);
Database glueDatabase = dbResult.getDatabase();
// Glue database location, description and parameters could be null
String glueDbLocation = glueDatabase.getLocationUri() == null ? "" : glueDatabase.getLocationUri();
String glueDbDescription = glueDatabase.getDescription() == null ? "" : glueDatabase.getDescription();
Map<String, String> glueParameters = new HashMap<>();
if (glueDatabase.getParameters() != null) {
glueParameters.putAll(glueDatabase.getParameters());
}
return new DatabaseInfo(glueDbLocation, mOwnerName, mOwnerType, glueDbDescription, glueParameters);
} catch (EntityNotFoundException e) {
throw new IOException("Cannot find glue database: " + mGlueDbName + "Catalog ID: " + mGlueConfiguration.get(Property.CATALOG_ID) + ". " + e.getMessage(), e);
}
}
Aggregations