/* * This file is a component of thundr, a software library from 3wks. * Read more: http://www.3wks.com.au/thundr * Copyright (C) 2013 3wks, <thundr@3wks.com.au> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.threewks.thundr.bigquery; import java.io.IOException; import java.util.List; public interface BigQueryPullService { /** * Execute a query and return the results as a list of strings. * * @param query the query to run. * @param includeColumnNames whether to include the column names as the first row of the results. * @return a list containing an entry for each row. * @throws IOException if something goes wrong running the query. */ public List<List<String>> query(String query, boolean includeColumnNames) throws IOException; /** * Execute a query asynchronously. * * @param query the query to run * @return a job id that can be used to retrieve the results later. * @throws IOException if something goes wrong running the query. */ public String queryAsync(String query) throws IOException; /** * Get the results of a previously run query. * * @param jobId the id of a job for a previously run query. * @param includeColumnNames whether to include the column names as the first row of the results. * @return a list containing an entry for each row, or null if the results are not ready yet. * @throws IOException if something goes wrong running the query. */ public List<List<String>> getAsyncQueryResults(String jobId, boolean includeColumnNames) throws IOException; /** * Get the status of a job. * * @param jobId the id of the job to get the status of. * @return a string showing the job status. * @throws IOException if something goes wrong getting the job status. */ public String getJobStatus(String jobId) throws IOException; }