use of com.amazonaws.services.glue.model.GetDatabaseRequest in project alluxio by Alluxio.
the class RemoteGlueTest method getDatabase.
@Test
public void getDatabase() {
GetDatabaseRequest dbRequest = new GetDatabaseRequest().withCatalogId(CATALOG_ID).withName(DB_NAME);
assertEquals(DB_NAME, mGlueDatabase.getClient().getDatabase(dbRequest).getDatabase().getName());
}
use of com.amazonaws.services.glue.model.GetDatabaseRequest 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