Search in sources :

Example 1 with TablesArgs

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

the class ExploreHttpClient method getTables.

@Override
public QueryHandle getTables(@Nullable String catalog, @Nullable String schemaPattern, String tableNamePattern, @Nullable List<String> tableTypes) throws ExploreException, SQLException {
    String body = GSON.toJson(new TablesArgs(catalog, schemaPattern, tableNamePattern, tableTypes));
    String resource = String.format("namespaces/%s/data/explore/jdbc/tables", 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 tables. Reason: " + response);
}
Also used : HttpResponse(co.cask.common.http.HttpResponse) TablesArgs(co.cask.cdap.explore.utils.TablesArgs) ExploreException(co.cask.cdap.explore.service.ExploreException)

Aggregations

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