use of com.google.cloud.bigquery.JobInfo in project google-cloud-java by GoogleCloudPlatform.
the class ITJobSnippets method testExists.
@Test
public void testExists() throws Exception {
JobConfiguration jobConfig = QueryJobConfiguration.newBuilder(QUERY).setUseLegacySql(false).build();
JobInfo jobInfo = JobInfo.newBuilder(jobConfig).build();
Job job = bigquery.create(jobInfo);
JobSnippets jobSnippets = new JobSnippets(job);
boolean result = jobSnippets.exists();
assertTrue(result);
}
use of com.google.cloud.bigquery.JobInfo in project google-cloud-java by GoogleCloudPlatform.
the class ITJobSnippets method testWaitFor.
@Test
public void testWaitFor() throws Exception {
JobConfiguration jobConfig = QueryJobConfiguration.newBuilder(QUERY).setUseLegacySql(false).build();
JobInfo jobInfo = JobInfo.newBuilder(jobConfig).build();
Job job = bigquery.create(jobInfo);
JobSnippets jobSnippets = new JobSnippets(job);
boolean result = jobSnippets.waitFor();
assertTrue(result);
}
use of com.google.cloud.bigquery.JobInfo in project google-cloud-java by GoogleCloudPlatform.
the class ITJobSnippets method testCancel.
@Test
public void testCancel() {
JobConfiguration jobConfig = QueryJobConfiguration.newBuilder(QUERY).setUseLegacySql(false).build();
JobInfo jobInfo = JobInfo.newBuilder(jobConfig).build();
Job job = bigquery.create(jobInfo);
JobSnippets jobSnippets = new JobSnippets(job);
boolean result = jobSnippets.cancel();
assertTrue(result);
}
use of com.google.cloud.bigquery.JobInfo in project google-cloud-java by GoogleCloudPlatform.
the class ITJobSnippets method testIsDone.
@Test
public void testIsDone() throws Exception {
JobConfiguration jobConfig = QueryJobConfiguration.newBuilder(QUERY).setUseLegacySql(false).build();
JobInfo jobInfo = JobInfo.newBuilder(jobConfig).build();
Job job = bigquery.create(jobInfo);
JobSnippets jobSnippets = new JobSnippets(job);
jobSnippets.isDone();
assertTrue(job.isDone());
}
use of com.google.cloud.bigquery.JobInfo in project google-cloud-java by GoogleCloudPlatform.
the class BigQuerySnippets method createJob.
/**
* Example of creating a query job.
*/
// [TARGET create(JobInfo, JobOption...)]
// [VARIABLE "SELECT field FROM my_dataset_name.my_table_name"]
public Job createJob(String query) {
// [START createJob]
Job job = null;
JobConfiguration jobConfiguration = QueryJobConfiguration.of(query);
JobInfo jobInfo = JobInfo.of(jobConfiguration);
try {
job = bigquery.create(jobInfo);
} catch (BigQueryException e) {
// the job was not created
}
// [END createJob]
return job;
}
Aggregations