use of com.amazonaws.services.glue.model.GetDatabasesResult in project presto by prestodb.
the class GlueHiveMetastore method getAllDatabases.
@Override
public List<String> getAllDatabases(MetastoreContext metastoreContext) {
try {
List<String> databaseNames = new ArrayList<>();
GetDatabasesRequest request = new GetDatabasesRequest().withCatalogId(catalogId);
do {
GetDatabasesResult result = stats.getGetDatabases().record(() -> glueClient.getDatabases(request));
request.setNextToken(result.getNextToken());
result.getDatabaseList().forEach(database -> databaseNames.add(database.getName()));
} while (request.getNextToken() != null);
return databaseNames;
} catch (AmazonServiceException e) {
throw new PrestoException(HIVE_METASTORE_ERROR, e);
}
}
Aggregations