Search in sources :

Example 1 with SchemasArgs

use of co.cask.cdap.explore.utils.SchemasArgs in project cdap by caskdata.

the class ExploreHttpClient method getSchemas.

@Override
public QueryHandle getSchemas(@Nullable String catalog, @Nullable String schemaPattern) throws ExploreException, SQLException {
    String body = GSON.toJson(new SchemasArgs(catalog, schemaPattern));
    String resource = String.format("namespaces/%s/data/explore/jdbc/schemas", schemaPattern);
    HttpResponse response = doPost(resource, body, null);
    if (response.getResponseCode() == HttpURLConnection.HTTP_OK) {
        return QueryHandle.fromId(parseResponseAsMap(response, "handle"));
    }
    throw new ExploreException("Cannot get the schemas. Reason: " + response);
}
Also used : HttpResponse(co.cask.common.http.HttpResponse) SchemasArgs(co.cask.cdap.explore.utils.SchemasArgs) ExploreException(co.cask.cdap.explore.service.ExploreException)

Aggregations

ExploreException (co.cask.cdap.explore.service.ExploreException)1 SchemasArgs (co.cask.cdap.explore.utils.SchemasArgs)1 HttpResponse (co.cask.common.http.HttpResponse)1