use of io.prestosql.queryeditorui.protocol.CatalogSchema in project hetu-core by openlookeng.
the class MetadataResource method getSchemasFromCatalog.
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("schemas/{catalog}")
public Response getSchemasFromCatalog(@PathParam("catalog") String catalogName, @Context HttpServletRequest servletRequest) throws ExecutionException {
String user = AccessControlUtil.getUser(accessControl, new HttpRequestSessionContext(servletRequest, groupProvider));
CatalogSchema catalogSchema = schemaService.querySchemas(catalogName, user);
return Response.ok(catalogSchema).build();
}
use of io.prestosql.queryeditorui.protocol.CatalogSchema in project hetu-core by openlookeng.
the class SchemaService method querySchemas.
public CatalogSchema querySchemas(String catalogName, String user) {
QueryRunner queryRunner = queryRunnerFactory.create(QueryEditorUIModule.UI_QUERY_SOURCE, user);
String statement = format("SHOW SCHEMAS FROM %s", catalogName);
Set<String> schemasResult = queryStatement(queryRunner, statement);
return new CatalogSchema(catalogName, ImmutableList.copyOf(schemasResult));
}
use of io.prestosql.queryeditorui.protocol.CatalogSchema in project hetu-core by openlookeng.
the class MetadataResource method getSchemas.
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("schemas")
public Response getSchemas(@Context HttpServletRequest servletRequest) throws ExecutionException {
String user = AccessControlUtil.getUser(accessControl, new HttpRequestSessionContext(servletRequest, groupProvider));
ImmutableList<CatalogSchema> result = schemaService.querySchemas(user);
return Response.ok(result).build();
}
Aggregations