Search in sources :

Example 1 with CatalogSchema

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();
}
Also used : CatalogSchema(io.prestosql.queryeditorui.protocol.CatalogSchema) HttpRequestSessionContext(io.prestosql.server.HttpRequestSessionContext) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 2 with CatalogSchema

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));
}
Also used : CatalogSchema(io.prestosql.queryeditorui.protocol.CatalogSchema) QueryRunner(io.prestosql.queryeditorui.execution.QueryRunner)

Example 3 with CatalogSchema

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();
}
Also used : CatalogSchema(io.prestosql.queryeditorui.protocol.CatalogSchema) HttpRequestSessionContext(io.prestosql.server.HttpRequestSessionContext) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

CatalogSchema (io.prestosql.queryeditorui.protocol.CatalogSchema)3 HttpRequestSessionContext (io.prestosql.server.HttpRequestSessionContext)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 QueryRunner (io.prestosql.queryeditorui.execution.QueryRunner)1