Search in sources :

Example 1 with GetQueryResults

use of com.google.api.services.bigquery.Bigquery.Jobs.GetQueryResults in project zeppelin by apache.

the class BigQueryInterpreter method run.

//Function to run the SQL on bigQuery service
public static Iterator<GetQueryResultsResponse> run(final String queryString, final String projId, final long wTime, final long maxRows) throws IOException {
    try {
        QueryResponse query = service.jobs().query(projId, new QueryRequest().setTimeoutMs(wTime).setQuery(queryString).setMaxResults(maxRows)).execute();
        jobId = query.getJobReference().getJobId();
        projectId = query.getJobReference().getProjectId();
        GetQueryResults getRequest = service.jobs().getQueryResults(projectId, jobId);
        return getPages(getRequest);
    } catch (IOException ex) {
        throw ex;
    }
}
Also used : QueryRequest(com.google.api.services.bigquery.model.QueryRequest) QueryResponse(com.google.api.services.bigquery.model.QueryResponse) IOException(java.io.IOException) GetQueryResults(com.google.api.services.bigquery.Bigquery.Jobs.GetQueryResults)

Aggregations

GetQueryResults (com.google.api.services.bigquery.Bigquery.Jobs.GetQueryResults)1 QueryRequest (com.google.api.services.bigquery.model.QueryRequest)1 QueryResponse (com.google.api.services.bigquery.model.QueryResponse)1 IOException (java.io.IOException)1