Search in sources :

Example 1 with Job

use of com.google.cloud.bigquery.Job in project google-cloud-java by GoogleCloudPlatform.

the class ITTableSnippets method testCopyTableId.

@Test
public void testCopyTableId() {
    Job copyJob = tableSnippets.copyTableId(COPY_DATASET_NAME, getCopyTableName());
    assertSuccessful(copyJob);
}
Also used : Job(com.google.cloud.bigquery.Job) Test(org.junit.Test)

Example 2 with Job

use of com.google.cloud.bigquery.Job in project google-cloud-java by GoogleCloudPlatform.

the class ITTableSnippets method testExtractAndLoadList.

@Test
public void testExtractAndLoadList() {
    String gcsFile1 = "gs://" + BUCKET_NAME + "/extractTestA_*.csv";
    String gcsFile2 = "gs://" + BUCKET_NAME + "/extractTestB_*.csv";
    Job extractJob = tableSnippets.extractList("CSV", gcsFile1, gcsFile2);
    gcsFile1 = gcsFile1.replace("*", "000000000000");
    gcsFile2 = gcsFile2.replace("*", "000000000000");
    assertSuccessful(extractJob);
    Job loadJob = tableSnippets.loadList(gcsFile1, gcsFile2);
    assertSuccessful(loadJob);
}
Also used : Job(com.google.cloud.bigquery.Job) Test(org.junit.Test)

Example 3 with Job

use of com.google.cloud.bigquery.Job 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);
}
Also used : JobInfo(com.google.cloud.bigquery.JobInfo) Job(com.google.cloud.bigquery.Job) QueryJobConfiguration(com.google.cloud.bigquery.QueryJobConfiguration) JobConfiguration(com.google.cloud.bigquery.JobConfiguration) Test(org.junit.Test)

Example 4 with Job

use of com.google.cloud.bigquery.Job 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);
}
Also used : JobInfo(com.google.cloud.bigquery.JobInfo) Job(com.google.cloud.bigquery.Job) QueryJobConfiguration(com.google.cloud.bigquery.QueryJobConfiguration) JobConfiguration(com.google.cloud.bigquery.JobConfiguration) Test(org.junit.Test)

Example 5 with Job

use of com.google.cloud.bigquery.Job 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);
}
Also used : JobInfo(com.google.cloud.bigquery.JobInfo) Job(com.google.cloud.bigquery.Job) QueryJobConfiguration(com.google.cloud.bigquery.QueryJobConfiguration) JobConfiguration(com.google.cloud.bigquery.JobConfiguration) Test(org.junit.Test)

Aggregations

Job (com.google.cloud.bigquery.Job)30 Test (org.junit.Test)21 TableId (com.google.cloud.bigquery.TableId)11 QueryJobConfiguration (com.google.cloud.bigquery.QueryJobConfiguration)10 JobConfiguration (com.google.cloud.bigquery.JobConfiguration)8 JobInfo (com.google.cloud.bigquery.JobInfo)8 Table (com.google.cloud.bigquery.Table)4 CopyJobConfiguration (com.google.cloud.bigquery.CopyJobConfiguration)3 FieldValue (com.google.cloud.bigquery.FieldValue)3 LoadStatistics (com.google.cloud.bigquery.JobStatistics.LoadStatistics)3 LoadJobConfiguration (com.google.cloud.bigquery.LoadJobConfiguration)3 StandardTableDefinition (com.google.cloud.bigquery.StandardTableDefinition)3 TableDataWriteChannel (com.google.cloud.bigquery.TableDataWriteChannel)3 TableInfo (com.google.cloud.bigquery.TableInfo)3 WriteChannelConfiguration (com.google.cloud.bigquery.WriteChannelConfiguration)3 TimeoutException (java.util.concurrent.TimeoutException)3 JobId (com.google.cloud.bigquery.JobId)2 JobStatistics (com.google.cloud.bigquery.JobStatistics)2 JobStatus (com.google.cloud.bigquery.JobStatus)2 QueryResponse (com.google.cloud.bigquery.QueryResponse)2