From b2d68c0aa0219a8c60bbd532c3fea5d0aeced716 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 19 Nov 2020 15:00:06 -0800 Subject: [PATCH 01/29] chore(java): retry staging portion of the release with backoff (#963) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/47723bad-582c-43dd-9712-b89133a40f21/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/68742c6016bf0d16948a572633d17955a8737414 --- .kokoro/common.sh | 1 - .kokoro/release/stage.sh | 17 ++++++++++------- synth.metadata | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index a8d0ea04d..ace89f45a 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -25,7 +25,6 @@ function retry_with_backoff { # allow a failures to continue set +e - echo "${command}" ${command} exit_code=$? diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh index 3c482cbc5..16126d2eb 100755 --- a/.kokoro/release/stage.sh +++ b/.kokoro/release/stage.sh @@ -20,19 +20,22 @@ python3 -m pip install gcp-releasetool python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script source $(dirname "$0")/common.sh +source $(dirname "$0")/../common.sh MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml pushd $(dirname "$0")/../../ setup_environment_secrets create_settings_xml_file "settings.xml" -mvn clean install deploy -B \ - --settings ${MAVEN_SETTINGS_FILE} \ - -DskipTests=true \ - -DperformRelease=true \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} +# attempt to stage 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn clean install deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DskipTests=true \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} if [[ -n "${AUTORELEASE_PR}" ]] then diff --git a/synth.metadata b/synth.metadata index 04a15b239..a7e17021d 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "449d27ab1a2cf0ab3ee5c10bb5843d648c7ea5f2" + "sha": "cc1db9077aa0422c7d224a0e4fa15186b2ea5e08" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "7fcc405a579d5d53a726ff3da1b7c8c08f0f2d58" + "sha": "68742c6016bf0d16948a572633d17955a8737414" } } ], From ae540905348fbd7653707c865e2c4320f2bff5bf Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 19 Nov 2020 15:16:05 -0800 Subject: [PATCH 02/29] chore: regenerate README (#966) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-11-19 23:04:12,502 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-bigquery/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working directory clean 2020-11-19 23:04:13,469 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/c3a69205-ad04-4828-9934-a21390c4bbc8/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index b19ffd1e8..48577b36a 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "211e67373865483d166f8b3ce0f07ba50de5fc5e" + "sha": "b2d68c0aa0219a8c60bbd532c3fea5d0aeced716" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "39b7149da4026765385403632db3c6f63db96b2c" + "sha": "68742c6016bf0d16948a572633d17955a8737414" } } ] diff --git a/README.md b/README.md index ae82760e5..13e0e729e 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,11 @@ If you are using Maven without BOM, add this to your dependencies: If you are using Gradle, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-bigquery:1.124.7' +compile 'com.google.cloud:google-cloud-bigquery:1.125.0' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "1.124.7" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "1.125.0" ``` ## Authentication From dd4876316f325b1319b5f4e1df478eead08064dd Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 19 Nov 2020 23:18:11 +0000 Subject: [PATCH 03/29] chore: release 1.125.1-SNAPSHOT (#965) :robot: I have created a release \*beep\* \*boop\* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index c72ef5401..edebf7205 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 1.125.0 + 1.125.1-SNAPSHOT diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index d23891740..c8d70ec7c 100644 --- a/google-cloud-bigquery/pom.xml +++ b/google-cloud-bigquery/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigquery - 1.125.0 + 1.125.1-SNAPSHOT jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 1.125.0 + 1.125.1-SNAPSHOT google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 9a0256a9f..bcba98036 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 1.125.0 + 1.125.1-SNAPSHOT BigQuery Parent https://github.com/googleapis/java-bigquery @@ -87,7 +87,7 @@ com.google.cloud google-cloud-bigquery - 1.125.0 + 1.125.1-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index b1c509261..945cb36f3 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 1.125.0 + 1.125.1-SNAPSHOT diff --git a/versions.txt b/versions.txt index 87095dc8b..bbaa41b16 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:1.125.0:1.125.0 \ No newline at end of file +google-cloud-bigquery:1.125.0:1.125.1-SNAPSHOT \ No newline at end of file From db1968bc3310c3a4a2da24f65a1299f1c6a9acec Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 20 Nov 2020 16:57:42 +0100 Subject: [PATCH 04/29] chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v1.125.0 (#964) --- samples/install-without-bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 165501077..fd3f35aaa 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -45,7 +45,7 @@ com.google.cloud google-cloud-bigquery - 1.124.7 + 1.125.0 From aa6c8e3d3c27589e4707cb80e9ba8e40d25ebd3b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 20 Nov 2020 08:12:09 -0800 Subject: [PATCH 05/29] chore: regenerate README (#967) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-11-20 16:00:16,074 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-bigquery/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working directory clean 2020-11-20 16:00:17,110 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/3125844a-6712-4ffc-a521-02d46c3b6cd8/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index 48577b36a..e647e91aa 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "b2d68c0aa0219a8c60bbd532c3fea5d0aeced716" + "sha": "db1968bc3310c3a4a2da24f65a1299f1c6a9acec" } }, { diff --git a/README.md b/README.md index 13e0e729e..c442de2bf 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-bigquery - 1.124.7 + 1.125.0 ``` From 08249bc556f5d9d0528f5440b4a615aebf5c8ec8 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 24 Nov 2020 13:12:12 -0800 Subject: [PATCH 06/29] build(java): enable blunderbuss for samples (#968) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/1f6fa2e1-d179-415f-ad3f-5e09e4a26806/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/943bb78606d035001123030067dffcc34f4645f2 --- .github/blunderbuss.yml | 7 +++++++ synth.metadata | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .github/blunderbuss.yml diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml new file mode 100644 index 000000000..1a23ea42b --- /dev/null +++ b/.github/blunderbuss.yml @@ -0,0 +1,7 @@ +# Configuration for the Blunderbuss GitHub app. For more info see +# https://github.com/googleapis/repo-automation-bots/tree/master/packages/blunderbuss +assign_prs_by: +- labels: + - samples + to: + - googleapis/java-samples-reviewers \ No newline at end of file diff --git a/synth.metadata b/synth.metadata index a7e17021d..142ab86c4 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "cc1db9077aa0422c7d224a0e4fa15186b2ea5e08" + "sha": "aa6c8e3d3c27589e4707cb80e9ba8e40d25ebd3b" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "68742c6016bf0d16948a572633d17955a8737414" + "sha": "943bb78606d035001123030067dffcc34f4645f2" } } ], @@ -21,6 +21,7 @@ ".github/ISSUE_TEMPLATE/feature_request.md", ".github/ISSUE_TEMPLATE/support_request.md", ".github/PULL_REQUEST_TEMPLATE.md", + ".github/blunderbuss.yml", ".github/generated-files-bot.yml", ".github/readme/synth.py", ".github/release-please.yml", From 3994be62b63b4b56944499c10b42d77ced4ab33c Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Wed, 25 Nov 2020 04:08:42 +0530 Subject: [PATCH 07/29] docs(samples): add create external table using hivepartitioningoptions (#969) --- .../bigquery/SetHivePartitioningOptions.java | 70 +++++++++++++++ .../SetHivePartitioningOptionsIT.java | 85 +++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/SetHivePartitioningOptions.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/SetHivePartitioningOptionsIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/SetHivePartitioningOptions.java b/samples/snippets/src/main/java/com/example/bigquery/SetHivePartitioningOptions.java new file mode 100644 index 000000000..0263c3905 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/SetHivePartitioningOptions.java @@ -0,0 +1,70 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +// [START bigquery_set_hivepartitioningoptions] +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.ExternalTableDefinition; +import com.google.cloud.bigquery.FormatOptions; +import com.google.cloud.bigquery.HivePartitioningOptions; +import com.google.cloud.bigquery.TableId; +import com.google.cloud.bigquery.TableInfo; + +// Sample to create external table using hive partitioning +public class SetHivePartitioningOptions { + + public static void main(String[] args) { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String tableName = "MY_TABLE_NAME"; + String sourceUri = "gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/*"; + String sourceUriPrefix = + "gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/{pkey:STRING}/"; + setHivePartitioningOptions(datasetName, tableName, sourceUriPrefix, sourceUri); + } + + public static void setHivePartitioningOptions( + String datasetName, String tableName, String sourceUriPrefix, String sourceUri) { + try { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + + // Configuring partitioning options + HivePartitioningOptions hivePartitioningOptions = + HivePartitioningOptions.newBuilder() + .setMode("CUSTOM") + .setRequirePartitionFilter(true) + .setSourceUriPrefix(sourceUriPrefix) + .build(); + + TableId tableId = TableId.of(datasetName, tableName); + ExternalTableDefinition customTable = + ExternalTableDefinition.newBuilder(sourceUri, FormatOptions.parquet()) + .setAutodetect(true) + .setHivePartitioningOptions(hivePartitioningOptions) + .build(); + bigquery.create(TableInfo.of(tableId, customTable)); + System.out.println("External table created using hivepartitioningoptions"); + } catch (BigQueryException e) { + System.out.println("External table was not created" + e.toString()); + } + } +} +// [END bigquery_set_hivepartitioningoptions] diff --git a/samples/snippets/src/test/java/com/example/bigquery/SetHivePartitioningOptionsIT.java b/samples/snippets/src/test/java/com/example/bigquery/SetHivePartitioningOptionsIT.java new file mode 100644 index 000000000..bc01e3861 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/SetHivePartitioningOptionsIT.java @@ -0,0 +1,85 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class SetHivePartitioningOptionsIT { + + private static final String ID = UUID.randomUUID().toString().substring(0, 8); + private final Logger log = Logger.getLogger(this.getClass().getName()); + private String tableName; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + private static final String BIGQUERY_DATASET_NAME = requireEnvVar("BIGQUERY_DATASET_NAME"); + + private static String requireEnvVar(String varName) { + String value = System.getenv(varName); + assertNotNull( + "Environment variable " + varName + " is required to perform these tests.", + System.getenv(varName)); + return value; + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("BIGQUERY_DATASET_NAME"); + } + + @Before + public void setUp() { + // Create a test table + tableName = "SET_HIVEPARTITIONINGOPTIONS_FROM_GCS_TEST_" + ID; + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + } + + @After + public void tearDown() { + // Clean up + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, tableName); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + log.log(Level.INFO, bout.toString()); + } + + @Test + public void testSetHivePartitioningOptions() { + String sourceUri = "gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/*"; + String sourceUriPrefix = + "gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/{pkey:STRING}/"; + SetHivePartitioningOptions.setHivePartitioningOptions( + BIGQUERY_DATASET_NAME, tableName, sourceUriPrefix, sourceUri); + assertThat(bout.toString()).contains("External table created using hivepartitioningoptions"); + } +} From 2edad15764f144268f1bd3052d1d0ac069a2f377 Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Wed, 25 Nov 2020 04:09:42 +0530 Subject: [PATCH 08/29] docs(samples): add export model (#970) --- .../com/example/bigquery/ExtractModel.java | 72 +++++++++++++++++ .../com/example/bigquery/ExtractModelIT.java | 77 +++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/ExtractModel.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/ExtractModelIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/ExtractModel.java b/samples/snippets/src/main/java/com/example/bigquery/ExtractModel.java new file mode 100644 index 000000000..9f5086330 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/ExtractModel.java @@ -0,0 +1,72 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +// [START bigquery_export_model] +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.ExtractJobConfiguration; +import com.google.cloud.bigquery.Job; +import com.google.cloud.bigquery.JobInfo; +import com.google.cloud.bigquery.ModelId; + +// Sample to extract model to GCS bucket +public class ExtractModel { + + public static void main(String[] args) throws InterruptedException { + // TODO(developer): Replace these variables before running the sample. + String projectName = "bigquery-public-data"; + String datasetName = "samples"; + String modelName = "model"; + String bucketName = "MY-BUCKET-NAME"; + String destinationUri = "gs://" + bucketName + "/path/to/file"; + extractModel(projectName, datasetName, modelName, destinationUri); + } + + public static void extractModel( + String projectName, String datasetName, String modelName, String destinationUri) + throws InterruptedException { + try { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + + ModelId modelId = ModelId.of(projectName, datasetName, modelName); + + ExtractJobConfiguration extractConfig = + ExtractJobConfiguration.newBuilder(modelId, destinationUri).build(); + + Job job = bigquery.create(JobInfo.of(extractConfig)); + + // Blocks until this job completes its execution, either failing or succeeding. + Job completedJob = job.waitFor(); + if (completedJob == null) { + System.out.println("Job not executed since it no longer exists."); + return; + } else if (completedJob.getStatus().getError() != null) { + System.out.println( + "BigQuery was unable to extract due to an error: \n" + job.getStatus().getError()); + return; + } + System.out.println("Model extract successful"); + } catch (BigQueryException ex) { + System.out.println("Model extraction job was interrupted. \n" + ex.toString()); + } + } +} +// [END bigquery_export_model] diff --git a/samples/snippets/src/test/java/com/example/bigquery/ExtractModelIT.java b/samples/snippets/src/test/java/com/example/bigquery/ExtractModelIT.java new file mode 100644 index 000000000..3e13e7816 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/ExtractModelIT.java @@ -0,0 +1,77 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ExtractModelIT { + + private final Logger log = Logger.getLogger(this.getClass().getName()); + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + private static final String GCS_BUCKET = System.getenv("GCS_BUCKET"); + + private static void requireEnvVar(String varName) { + assertNotNull( + "Environment variable " + varName + " is required to perform these tests.", + System.getenv(varName)); + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("GCS_BUCKET"); + } + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + } + + @After + public void tearDown() { + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + log.log(Level.INFO, bout.toString()); + } + + @Test + public void testExtractModel() throws InterruptedException { + String projectId = "bigquery-public-data"; + String datasetName = "samples"; + String modelName = "model"; + String destinationUri = "gs://" + GCS_BUCKET + "/extractModel"; + // Extract model content to GCS + ExtractModel.extractModel(projectId, datasetName, modelName, destinationUri); + assertThat(bout.toString()).contains("Model extract successful"); + } +} From 9028ee4a0b70180b5dd1eb182aadaac319332009 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 24 Nov 2020 14:52:02 -0800 Subject: [PATCH 09/29] chore: regenerate README (#973) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-11-24 22:41:03,520 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-bigquery/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working directory clean 2020-11-24 22:41:04,490 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/0a1ea985-3581-47e9-a701-5894d322dfea/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 4 ++-- README.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index e647e91aa..adc5cdd74 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "db1968bc3310c3a4a2da24f65a1299f1c6a9acec" + "sha": "2edad15764f144268f1bd3052d1d0ac069a2f377" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "68742c6016bf0d16948a572633d17955a8737414" + "sha": "c2de32114ec484aa708d32012d1fa8d75232daf5" } } ] diff --git a/README.md b/README.md index c442de2bf..a43988537 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ has instructions for running the samples. | Delete Routine | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteRoutine.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/DeleteRoutine.java) | | Delete Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteTable.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/DeleteTable.java) | | Export Query Results To S3 | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/ExportQueryResultsToS3.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/ExportQueryResultsToS3.java) | +| Extract Model | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/ExtractModel.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/ExtractModel.java) | | Extract Table Compressed | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/ExtractTableCompressed.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/ExtractTableCompressed.java) | | Extract Table To Csv | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/ExtractTableToCsv.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/ExtractTableToCsv.java) | | Extract Table To Json | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/ExtractTableToJson.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/ExtractTableToJson.java) | @@ -200,6 +201,7 @@ has instructions for running the samples. | Resource Clean Up | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/ResourceCleanUp.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/ResourceCleanUp.java) | | Run Legacy Query | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/RunLegacyQuery.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/RunLegacyQuery.java) | | Save Query To Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/SaveQueryToTable.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/SaveQueryToTable.java) | +| Set Hive Partitioning Options | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/SetHivePartitioningOptions.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/SetHivePartitioningOptions.java) | | Simple App | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/SimpleApp.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/SimpleApp.java) | | Simple Query | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/SimpleQuery.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/SimpleQuery.java) | | Table Exists | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/TableExists.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/TableExists.java) | From 1739d57c59cfb6b90ccf3fcc9c07d1449fc17238 Mon Sep 17 00:00:00 2001 From: David Rabinowitz Date: Wed, 25 Nov 2020 06:26:53 -0800 Subject: [PATCH 10/29] fix: update listPartitions() to support tables from other projects (#974) * fix: update listPartitions() to support tables from other projects * code format Co-authored-by: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com> Co-authored-by: yoshi-code-bot <70984784+yoshi-code-bot@users.noreply.github.com> --- .../main/java/com/google/cloud/bigquery/BigQueryImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java index 0ed1ca68c..d402ce549 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java @@ -848,8 +848,12 @@ public Page listRoutines(DatasetId datasetId, RoutineListOption... opti @Override public List listPartitions(TableId tableId) { List partitions = new ArrayList(); - Table metaTable = - getTable(TableId.of(tableId.getDataset(), tableId.getTable() + "$__PARTITIONS_SUMMARY__")); + String partitionsTable = tableId.getTable() + "$__PARTITIONS_SUMMARY__"; + TableId metaTableId = + tableId.getProject() == null + ? TableId.of(tableId.getDataset(), partitionsTable) + : TableId.of(tableId.getProject(), tableId.getDataset(), partitionsTable); + Table metaTable = getTable(metaTableId); Schema metaSchema = metaTable.getDefinition().getSchema(); String partition_id = null; for (Field field : metaSchema.getFields()) { From 07ff507295495ea1b4612957dbe2c4fd80850e25 Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Tue, 1 Dec 2020 00:22:57 +0530 Subject: [PATCH 11/29] test: add IT for HivePartitioningOptions (#981) --- .../cloud/bigquery/it/ITBigQueryTest.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index 3a3af4898..07eeb9f3a 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -62,6 +62,7 @@ import com.google.cloud.bigquery.FieldValue; import com.google.cloud.bigquery.FieldValueList; import com.google.cloud.bigquery.FormatOptions; +import com.google.cloud.bigquery.HivePartitioningOptions; import com.google.cloud.bigquery.InsertAllRequest; import com.google.cloud.bigquery.InsertAllResponse; import com.google.cloud.bigquery.Job; @@ -1703,6 +1704,65 @@ public void testQueryCaseInsensitiveSchemaFieldByGetName() throws InterruptedExc assertEquals(2, rowCount); } + @Test + public void testQueryExternalHivePartitioningOptionAutoLayout() throws InterruptedException { + String tableName = "test_queryexternalhivepartition_autolayout_table"; + String sourceUri = "gs://cloud-samples-data/bigquery/hive-partitioning-samples/autolayout/*"; + String sourceUriPrefix = + "gs://cloud-samples-data/bigquery/hive-partitioning-samples/autolayout/"; + HivePartitioningOptions hivePartitioningOptions = + HivePartitioningOptions.newBuilder() + .setMode("AUTO") + .setRequirePartitionFilter(true) + .setSourceUriPrefix(sourceUriPrefix) + .build(); + TableId tableId = TableId.of(DATASET, tableName); + ExternalTableDefinition externalTable = + ExternalTableDefinition.newBuilder(sourceUri, FormatOptions.parquet()) + .setAutodetect(true) + .setHivePartitioningOptions(hivePartitioningOptions) + .build(); + assertNotNull(bigquery.create(TableInfo.of(tableId, externalTable))); + String query = + String.format( + "SELECT COUNT(*) as ct FROM %s.%s WHERE dt=\"2020-11-15\"", DATASET, tableName); + TableResult result = bigquery.query(QueryJobConfiguration.of(query)); + for (FieldValueList fieldValues : result.iterateAll()) { + assertEquals(50, fieldValues.get("ct").getLongValue()); + } + assertEquals(1, result.getTotalRows()); + assertTrue(bigquery.delete(tableId)); + } + + @Test + public void testQueryExternalHivePartitioningOptionCustomLayout() throws InterruptedException { + String tableName = "test_queryexternalhivepartition_customlayout_table"; + String sourceUri = "gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/*"; + String sourceUriPrefix = + "gs://cloud-samples-data/bigquery/hive-partitioning-samples/customlayout/{pkey:STRING}/"; + HivePartitioningOptions hivePartitioningOptions = + HivePartitioningOptions.newBuilder() + .setMode("CUSTOM") + .setRequirePartitionFilter(true) + .setSourceUriPrefix(sourceUriPrefix) + .build(); + TableId tableId = TableId.of(DATASET, tableName); + ExternalTableDefinition externalTable = + ExternalTableDefinition.newBuilder(sourceUri, FormatOptions.parquet()) + .setAutodetect(true) + .setHivePartitioningOptions(hivePartitioningOptions) + .build(); + assertNotNull(bigquery.create(TableInfo.of(tableId, externalTable))); + String query = + String.format("SELECT COUNT(*) as ct FROM %s.%s WHERE pkey=\"foo\"", DATASET, tableName); + TableResult result = bigquery.query(QueryJobConfiguration.of(query)); + for (FieldValueList fieldValues : result.iterateAll()) { + assertEquals(50, fieldValues.get("ct").getLongValue()); + } + assertEquals(1, result.getTotalRows()); + assertTrue(bigquery.delete(tableId)); + } + @Test public void testFastQueryMultipleRuns() throws InterruptedException { String query = From 0cfc98bffc9970d3275cc233d59c621ddbb6aea6 Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Tue, 1 Dec 2020 00:23:17 +0530 Subject: [PATCH 12/29] docs(samples): add create iam policy for table (#975) --- .../com/example/bigquery/CreateIamPolicy.java | 58 +++++++++++++ .../example/bigquery/CreateIamPolicyIT.java | 83 +++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/CreateIamPolicy.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/CreateIamPolicyIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/CreateIamPolicy.java b/samples/snippets/src/main/java/com/example/bigquery/CreateIamPolicy.java new file mode 100644 index 000000000..960f28071 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/CreateIamPolicy.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +// [START bigquery_create_iam_policy] +import com.google.cloud.Identity; +import com.google.cloud.Policy; +import com.google.cloud.Role; +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.TableId; + +// Sample to create iam policy for table +public class CreateIamPolicy { + + public static void main(String[] args) { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String tableName = "MY_TABLE_NAME"; + createIamPolicy(datasetName, tableName); + } + + public static void createIamPolicy(String datasetName, String tableName) { + try { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + + TableId tableId = TableId.of(datasetName, tableName); + + Policy policy = bigquery.getIamPolicy(tableId); + policy + .toBuilder() + .addIdentity(Role.of("roles/bigquery.dataViewer"), Identity.allUsers()) + .build(); + bigquery.setIamPolicy(tableId, policy); + System.out.println("Iam policy created successfully"); + } catch (BigQueryException e) { + System.out.println("Iam policy was not created. \n" + e.toString()); + } + } +} +// [END bigquery_create_iam_policy] diff --git a/samples/snippets/src/test/java/com/example/bigquery/CreateIamPolicyIT.java b/samples/snippets/src/test/java/com/example/bigquery/CreateIamPolicyIT.java new file mode 100644 index 000000000..420d81e40 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/CreateIamPolicyIT.java @@ -0,0 +1,83 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +import com.google.cloud.bigquery.Schema; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CreateIamPolicyIT { + + private final Logger log = Logger.getLogger(this.getClass().getName()); + private String tableName; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + private static final String BIGQUERY_DATASET_NAME = requireEnvVar("BIGQUERY_DATASET_NAME"); + + private static String requireEnvVar(String varName) { + String value = System.getenv(varName); + assertNotNull( + "Environment variable " + varName + " is required to perform these tests.", + System.getenv(varName)); + return value; + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("BIGQUERY_DATASET_NAME"); + } + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + + // create a temporary table + tableName = "CREATE_POLICY_TABLE_TEST_" + UUID.randomUUID().toString().substring(0, 8); + CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, Schema.of()); + } + + @After + public void tearDown() { + // Clean up + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, tableName); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + log.log(Level.INFO, bout.toString()); + } + + @Test + public void testCreateIamPolicy() { + CreateIamPolicy.createIamPolicy(BIGQUERY_DATASET_NAME, tableName); + assertThat(bout.toString()).contains("Iam policy created successfully"); + } +} From 155e6882aebdb4ac93e1e78baac0579ca7e11bd1 Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Tue, 1 Dec 2020 00:26:38 +0530 Subject: [PATCH 13/29] docs(samples): add create materialized view (#977) --- .../bigquery/CreateMaterializedView.java | 63 +++++++++++ .../bigquery/CreateMaterializedViewIT.java | 101 ++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/CreateMaterializedView.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/CreateMaterializedViewIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/CreateMaterializedView.java b/samples/snippets/src/main/java/com/example/bigquery/CreateMaterializedView.java new file mode 100644 index 000000000..0781cf151 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/CreateMaterializedView.java @@ -0,0 +1,63 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +// [START bigquery_create_materialized_view] +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.MaterializedViewDefinition; +import com.google.cloud.bigquery.TableId; +import com.google.cloud.bigquery.TableInfo; + +// Sample to create materialized view +public class CreateMaterializedView { + + public static void main(String[] args) { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String tableName = "MY_TABLE_NAME"; + String materializedViewName = "MY_MATERIALIZED_VIEW_NAME"; + String query = + String.format( + "SELECT MAX(TimestampField) AS TimestampField, StringField, " + + "MAX(BooleanField) AS BooleanField " + + "FROM %s.%s GROUP BY StringField", + datasetName, tableName); + createMaterializedView(datasetName, materializedViewName, query); + } + + public static void createMaterializedView( + String datasetName, String materializedViewName, String query) { + try { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + + TableId tableId = TableId.of(datasetName, materializedViewName); + + MaterializedViewDefinition materializedViewDefinition = + MaterializedViewDefinition.newBuilder(query).build(); + + bigquery.create(TableInfo.of(tableId, materializedViewDefinition)); + System.out.println("Materialized view created successfully"); + } catch (BigQueryException e) { + System.out.println("Materialized view was not created. \n" + e.toString()); + } + } +} +// [END bigquery_create_materialized_view] diff --git a/samples/snippets/src/test/java/com/example/bigquery/CreateMaterializedViewIT.java b/samples/snippets/src/test/java/com/example/bigquery/CreateMaterializedViewIT.java new file mode 100644 index 000000000..7d4ec84b2 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/CreateMaterializedViewIT.java @@ -0,0 +1,101 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +import com.google.cloud.bigquery.Field; +import com.google.cloud.bigquery.Schema; +import com.google.cloud.bigquery.StandardSQLTypeName; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CreateMaterializedViewIT { + + private static final String ID = UUID.randomUUID().toString().substring(0, 8); + private final Logger log = Logger.getLogger(this.getClass().getName()); + private String tableName; + private String materializedViewName; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + private static final String BIGQUERY_DATASET_NAME = requireEnvVar("BIGQUERY_DATASET_NAME"); + + private static String requireEnvVar(String varName) { + String value = System.getenv(varName); + assertNotNull( + "Environment variable " + varName + " is required to perform these tests.", + System.getenv(varName)); + return value; + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("BIGQUERY_DATASET_NAME"); + } + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + + tableName = "MY_TABLE_NAME_TEST_" + ID; + materializedViewName = "MY_MATERIALIZED_VIEW_NAME_TEST_" + ID; + + Schema schema = + Schema.of( + Field.of("timestampField", StandardSQLTypeName.TIMESTAMP), + Field.of("stringField", StandardSQLTypeName.STRING), + Field.of("booleanField", StandardSQLTypeName.BOOL)); + CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, schema); + } + + @After + public void tearDown() { + // Clean up + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, materializedViewName); + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, tableName); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + log.log(Level.INFO, bout.toString()); + } + + @Test + public void testCreateMaterializedView() { + String query = + String.format( + "SELECT MAX(TimestampField) AS TimestampField, StringField, " + + "MAX(BooleanField) AS BooleanField " + + "FROM %s.%s GROUP BY StringField", + BIGQUERY_DATASET_NAME, tableName); + CreateMaterializedView.createMaterializedView( + BIGQUERY_DATASET_NAME, materializedViewName, query); + assertThat(bout.toString()).contains("Materialized view created successfully"); + } +} From d1189e5afece0d2aa57b84181ad8e097b36b4cd7 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 30 Nov 2020 11:06:02 -0800 Subject: [PATCH 14/29] chore: regenerate README (#982) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-11-30 18:55:02,649 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-bigquery/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working directory clean 2020-11-30 18:55:04,346 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/58f9afd4-0bc2-4f0c-b2e4-981bbd72657a/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 2 +- README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index adc5cdd74..d1d3786d8 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "2edad15764f144268f1bd3052d1d0ac069a2f377" + "sha": "0cfc98bffc9970d3275cc233d59c621ddbb6aea6" } }, { diff --git a/README.md b/README.md index a43988537..7a290b8f2 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ has instructions for running the samples. | Create Dataset | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateDataset.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateDataset.java) | | Create Dataset Aws | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateDatasetAws.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateDatasetAws.java) | | Create External Table Aws | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateExternalTableAws.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateExternalTableAws.java) | +| Create Iam Policy | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateIamPolicy.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateIamPolicy.java) | | Create Job | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateJob.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateJob.java) | | Create Model | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateModel.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateModel.java) | | Create Partitioned Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreatePartitionedTable.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreatePartitionedTable.java) | From 890098ae0492cd90c96418238482972f81895a1a Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 30 Nov 2020 11:20:03 -0800 Subject: [PATCH 15/29] chore: regenerate README (#983) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-11-30 19:08:23,642 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-bigquery/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working directory clean 2020-11-30 19:08:24,696 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/91b9c857-dfe1-4348-aa1d-d09406e7a535/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 2 +- README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index d1d3786d8..0a32b6deb 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "0cfc98bffc9970d3275cc233d59c621ddbb6aea6" + "sha": "d1189e5afece0d2aa57b84181ad8e097b36b4cd7" } }, { diff --git a/README.md b/README.md index 7a290b8f2..a82371bdc 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ has instructions for running the samples. | Create External Table Aws | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateExternalTableAws.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateExternalTableAws.java) | | Create Iam Policy | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateIamPolicy.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateIamPolicy.java) | | Create Job | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateJob.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateJob.java) | +| Create Materialized View | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateMaterializedView.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateMaterializedView.java) | | Create Model | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateModel.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateModel.java) | | Create Partitioned Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreatePartitionedTable.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreatePartitionedTable.java) | | Create Range Partitioned Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateRangePartitionedTable.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/CreateRangePartitionedTable.java) | From 37c0632500366006aecab18b21a10bf8956c4b6c Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Tue, 1 Dec 2020 01:21:37 +0530 Subject: [PATCH 16/29] docs(samples): add alter materialized view (#979) --- .../bigquery/AlterMaterializedView.java | 61 +++++++++++ .../bigquery/AlterMaterializedViewIT.java | 102 ++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/AlterMaterializedView.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/AlterMaterializedViewIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/AlterMaterializedView.java b/samples/snippets/src/main/java/com/example/bigquery/AlterMaterializedView.java new file mode 100644 index 000000000..8ce25196f --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/AlterMaterializedView.java @@ -0,0 +1,61 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +// [START bigquery_alter_materialized_view] +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.MaterializedViewDefinition; +import com.google.cloud.bigquery.Table; +import com.google.cloud.bigquery.TableId; + +// Sample to alter materialized view +public class AlterMaterializedView { + + public static void main(String[] args) { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String materializedViewName = "MY_MATERIALIZED_VIEW_NAME"; + alterMaterializedView(datasetName, materializedViewName); + } + + public static void alterMaterializedView(String datasetName, String materializedViewName) { + try { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + + TableId tableId = TableId.of(datasetName, materializedViewName); + + // Get existing materialized view + Table table = bigquery.getTable(tableId); + MaterializedViewDefinition materializedViewDefinition = table.getDefinition(); + // Alter materialized view + materializedViewDefinition + .toBuilder() + .setEnableRefresh(true) + .setRefreshIntervalMs(1000L) + .build(); + table.toBuilder().setDefinition(materializedViewDefinition).build().update(); + System.out.println("Materialized view altered successfully"); + } catch (BigQueryException e) { + System.out.println("Materialized view was not altered. \n" + e.toString()); + } + } +} +// [END bigquery_alter_materialized_view] diff --git a/samples/snippets/src/test/java/com/example/bigquery/AlterMaterializedViewIT.java b/samples/snippets/src/test/java/com/example/bigquery/AlterMaterializedViewIT.java new file mode 100644 index 000000000..3cc5dfa7c --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/AlterMaterializedViewIT.java @@ -0,0 +1,102 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +import com.google.cloud.bigquery.Field; +import com.google.cloud.bigquery.Schema; +import com.google.cloud.bigquery.StandardSQLTypeName; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AlterMaterializedViewIT { + + private static final String ID = UUID.randomUUID().toString().substring(0, 8); + private final Logger log = Logger.getLogger(this.getClass().getName()); + private String tableName; + private String materializedViewName; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + private static final String BIGQUERY_DATASET_NAME = requireEnvVar("BIGQUERY_DATASET_NAME"); + + private static String requireEnvVar(String varName) { + String value = System.getenv(varName); + assertNotNull( + "Environment variable " + varName + " is required to perform these tests.", + System.getenv(varName)); + return value; + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("BIGQUERY_DATASET_NAME"); + } + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + + tableName = "MY_TABLE_NAME_TEST_" + ID; + materializedViewName = "MY_ALTER_MATERIALIZED_VIEW_NAME_TEST_" + ID; + + Schema schema = + Schema.of( + Field.of("timestampField", StandardSQLTypeName.TIMESTAMP), + Field.of("stringField", StandardSQLTypeName.STRING), + Field.of("booleanField", StandardSQLTypeName.BOOL)); + CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, schema); + String query = + String.format( + "SELECT MAX(TimestampField) AS TimestampField, StringField, " + + "MAX(BooleanField) AS BooleanField " + + "FROM %s.%s GROUP BY StringField", + BIGQUERY_DATASET_NAME, tableName); + CreateMaterializedView.createMaterializedView( + BIGQUERY_DATASET_NAME, materializedViewName, query); + } + + @After + public void tearDown() { + // Clean up + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, materializedViewName); + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, tableName); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + log.log(Level.INFO, bout.toString()); + } + + @Test + public void testAlterMaterializedView() { + AlterMaterializedView.alterMaterializedView(BIGQUERY_DATASET_NAME, materializedViewName); + assertThat(bout.toString()).contains("Materialized view altered successfully"); + } +} From 022cb99b486d27c91f478353ab47df4b8e184e4a Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Tue, 1 Dec 2020 01:24:09 +0530 Subject: [PATCH 17/29] docs(samples): add delete materialized view (#980) --- .../bigquery/DeleteMaterializedView.java | 54 ++++++++++ .../bigquery/DeleteMaterializedViewIT.java | 101 ++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/DeleteMaterializedView.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/DeleteMaterializedViewIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/DeleteMaterializedView.java b/samples/snippets/src/main/java/com/example/bigquery/DeleteMaterializedView.java new file mode 100644 index 000000000..5433bec3b --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/DeleteMaterializedView.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +// [START bigquery_delete_materialized_view] +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.TableId; + +// Sample to delete materialized view +public class DeleteMaterializedView { + + public static void main(String[] args) { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String materializedViewName = "MY_MATERIALIZED_VIEW_NAME"; + deleteMaterializedView(datasetName, materializedViewName); + } + + public static void deleteMaterializedView(String datasetName, String materializedViewName) { + try { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + + TableId tableId = TableId.of(datasetName, materializedViewName); + + boolean success = bigquery.delete(tableId); + if (success) { + System.out.println("Materialized view deleted successfully"); + } else { + System.out.println("Materialized view was not found"); + } + } catch (BigQueryException e) { + System.out.println("Materialized view was not found. \n" + e.toString()); + } + } +} +// [END bigquery_delete_materialized_view] diff --git a/samples/snippets/src/test/java/com/example/bigquery/DeleteMaterializedViewIT.java b/samples/snippets/src/test/java/com/example/bigquery/DeleteMaterializedViewIT.java new file mode 100644 index 000000000..bd5be8fe9 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/DeleteMaterializedViewIT.java @@ -0,0 +1,101 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +import com.google.cloud.bigquery.Field; +import com.google.cloud.bigquery.Schema; +import com.google.cloud.bigquery.StandardSQLTypeName; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class DeleteMaterializedViewIT { + + private static final String ID = UUID.randomUUID().toString().substring(0, 8); + private final Logger log = Logger.getLogger(this.getClass().getName()); + private String tableName; + private String materializedViewName; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + private static final String BIGQUERY_DATASET_NAME = requireEnvVar("BIGQUERY_DATASET_NAME"); + + private static String requireEnvVar(String varName) { + String value = System.getenv(varName); + assertNotNull( + "Environment variable " + varName + " is required to perform these tests.", + System.getenv(varName)); + return value; + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("BIGQUERY_DATASET_NAME"); + } + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + + tableName = "MY_TABLE_NAME_TEST_" + ID; + materializedViewName = "MY_ALTER_MATERIALIZED_VIEW_NAME_TEST_" + ID; + + Schema schema = + Schema.of( + Field.of("timestampField", StandardSQLTypeName.TIMESTAMP), + Field.of("stringField", StandardSQLTypeName.STRING), + Field.of("booleanField", StandardSQLTypeName.BOOL)); + CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, schema); + String query = + String.format( + "SELECT MAX(TimestampField) AS TimestampField, StringField, " + + "MAX(BooleanField) AS BooleanField " + + "FROM %s.%s GROUP BY StringField", + BIGQUERY_DATASET_NAME, tableName); + CreateMaterializedView.createMaterializedView( + BIGQUERY_DATASET_NAME, materializedViewName, query); + } + + @After + public void tearDown() { + // Clean up + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, tableName); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + log.log(Level.INFO, bout.toString()); + } + + @Test + public void testDeleteMaterializedView() { + DeleteMaterializedView.deleteMaterializedView(BIGQUERY_DATASET_NAME, materializedViewName); + assertThat(bout.toString()).contains("Materialized view deleted successfully"); + } +} From 5b0c7a2fd80f571b3b128b158c403673cca722cb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 30 Nov 2020 12:06:03 -0800 Subject: [PATCH 18/29] chore: regenerate README (#984) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-11-30 19:53:57,593 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-bigquery/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working directory clean 2020-11-30 19:53:58,629 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/5046f6ba-f07a-41da-ac00-e8ab54b3c150/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 2 +- README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index 0a32b6deb..be0b1ea06 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "d1189e5afece0d2aa57b84181ad8e097b36b4cd7" + "sha": "37c0632500366006aecab18b21a10bf8956c4b6c" } }, { diff --git a/README.md b/README.md index a82371bdc..4bb561ad4 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ has instructions for running the samples. | --------------------------- | --------------------------------- | ------ | | Add Column Load Append | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/AddColumnLoadAppend.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AddColumnLoadAppend.java) | | Add Empty Column | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/AddEmptyColumn.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AddEmptyColumn.java) | +| Alter Materialized View | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/AlterMaterializedView.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AlterMaterializedView.java) | | Auth Drive Scope | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/AuthDriveScope.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AuthDriveScope.java) | | Auth Snippets | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/AuthSnippets.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AuthSnippets.java) | | Auth User Flow | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/AuthUserFlow.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/AuthUserFlow.java) | From 8be3b77bfeceeb95dc950b66523fe516cff27fd0 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 30 Nov 2020 12:20:03 -0800 Subject: [PATCH 19/29] chore: regenerate README (#985) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-11-30 20:08:11,353 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-bigquery/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working directory clean 2020-11-30 20:08:12,370 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/d00c74f6-b386-4587-96c9-9624c9611fc9/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 2 +- README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index be0b1ea06..3f25aaa0c 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "37c0632500366006aecab18b21a10bf8956c4b6c" + "sha": "5b0c7a2fd80f571b3b128b158c403673cca722cb" } }, { diff --git a/README.md b/README.md index 4bb561ad4..ff1599006 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ has instructions for running the samples. | Delete Dataset And Contents | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteDatasetAndContents.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/DeleteDatasetAndContents.java) | | Delete Label Dataset | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteLabelDataset.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/DeleteLabelDataset.java) | | Delete Label Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteLabelTable.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/DeleteLabelTable.java) | +| Delete Materialized View | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteMaterializedView.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/DeleteMaterializedView.java) | | Delete Model | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteModel.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/DeleteModel.java) | | Delete Routine | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteRoutine.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/DeleteRoutine.java) | | Delete Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteTable.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/DeleteTable.java) | From aeecac905911dbe1ee534f0e5eeef2705a0cb6b3 Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Tue, 1 Dec 2020 22:34:39 +0530 Subject: [PATCH 20/29] docs(samples): add update iam policy for table (#976) * docs(samples): add update iam policy for table * docs(samples): fix format --- .../com/example/bigquery/UpdateIamPolicy.java | 62 ++++++++++++++ .../example/bigquery/UpdateIamPolicyIT.java | 84 +++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/UpdateIamPolicy.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/UpdateIamPolicyIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/UpdateIamPolicy.java b/samples/snippets/src/main/java/com/example/bigquery/UpdateIamPolicy.java new file mode 100644 index 000000000..6956b2d92 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/UpdateIamPolicy.java @@ -0,0 +1,62 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +// [START bigquery_update_iam_policy] +import com.google.cloud.Identity; +import com.google.cloud.Policy; +import com.google.cloud.Role; +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.TableId; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +// Sample to update iam policy in table +public class UpdateIamPolicy { + + public static void main(String[] args) { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String tableName = "MY_TABLE_NAME"; + updateIamPolicy(datasetName, tableName); + } + + public static void updateIamPolicy(String datasetName, String tableName) { + try { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + + TableId tableId = TableId.of(datasetName, tableName); + + Policy policy = bigquery.getIamPolicy(tableId); + Map> binding = new HashMap<>(policy.getBindings()); + binding.remove(Role.of("roles/bigquery.dataViewer")); + + policy.toBuilder().setBindings(binding).build(); + bigquery.setIamPolicy(tableId, policy); + + System.out.println("Iam policy updated successfully"); + } catch (BigQueryException e) { + System.out.println("Iam policy was not updated. \n" + e.toString()); + } + } +} +// [END bigquery_update_iam_policy] diff --git a/samples/snippets/src/test/java/com/example/bigquery/UpdateIamPolicyIT.java b/samples/snippets/src/test/java/com/example/bigquery/UpdateIamPolicyIT.java new file mode 100644 index 000000000..196fcd4ef --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/UpdateIamPolicyIT.java @@ -0,0 +1,84 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +import com.google.cloud.bigquery.Schema; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class UpdateIamPolicyIT { + + private final Logger log = Logger.getLogger(this.getClass().getName()); + private String tableName; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + private static final String BIGQUERY_DATASET_NAME = requireEnvVar("BIGQUERY_DATASET_NAME"); + + private static String requireEnvVar(String varName) { + String value = System.getenv(varName); + assertNotNull( + "Environment variable " + varName + " is required to perform these tests.", + System.getenv(varName)); + return value; + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("BIGQUERY_DATASET_NAME"); + } + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + + // create a temporary table + tableName = "UPDATE_POLICY_TABLE_TEST_" + UUID.randomUUID().toString().substring(0, 8); + CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, Schema.of()); + CreateIamPolicy.createIamPolicy(BIGQUERY_DATASET_NAME, tableName); + } + + @After + public void tearDown() { + // Clean up + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, tableName); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + log.log(Level.INFO, bout.toString()); + } + + @Test + public void testUpdateIamPolicy() { + UpdateIamPolicy.updateIamPolicy(BIGQUERY_DATASET_NAME, tableName); + assertThat(bout.toString()).contains("Iam policy updated successfully"); + } +} From cf36b82ef9bc0849a87b717c099321915a76b967 Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Tue, 1 Dec 2020 22:35:21 +0530 Subject: [PATCH 21/29] docs(samples): add query materialized view (#978) * docs(samples): add query materialized view * docs(samples): address feedback --- .../bigquery/QueryMaterializedView.java | 51 +++++++++ .../bigquery/QueryMaterializedViewIT.java | 104 ++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/QueryMaterializedView.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/QueryMaterializedViewIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/QueryMaterializedView.java b/samples/snippets/src/main/java/com/example/bigquery/QueryMaterializedView.java new file mode 100644 index 000000000..22876c40d --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/QueryMaterializedView.java @@ -0,0 +1,51 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.QueryJobConfiguration; +import com.google.cloud.bigquery.TableResult; + +public class QueryMaterializedView { + + public static void main(String[] args) throws InterruptedException { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String materializedViewName = "MY_MATERIALIZED_VIEW_NAME"; + String query = String.format("SELECT * FROM %s.%s", datasetName, materializedViewName); + queryMaterializedView(query); + } + + public static void queryMaterializedView(String query) throws InterruptedException { + try { + // Initialize client that will be used to send requests. This client only needs to be created + // once, and can be reused for multiple requests. + BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); + + TableResult results = bigquery.query(QueryJobConfiguration.of(query)); + results + .iterateAll() + .forEach(row -> row.forEach(val -> System.out.printf("%s\n", val.toString()))); + + System.out.println("Query performed successfully."); + } catch (BigQueryException e) { + System.out.println("Query was not performed. \n" + e.toString()); + } + } +} diff --git a/samples/snippets/src/test/java/com/example/bigquery/QueryMaterializedViewIT.java b/samples/snippets/src/test/java/com/example/bigquery/QueryMaterializedViewIT.java new file mode 100644 index 000000000..7e84daf28 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/QueryMaterializedViewIT.java @@ -0,0 +1,104 @@ +/* + * Copyright 2020 Google LLC + * + * 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.example.bigquery; + +import static com.google.common.truth.Truth.assertThat; +import static junit.framework.TestCase.assertNotNull; + +import com.google.cloud.bigquery.Field; +import com.google.cloud.bigquery.Schema; +import com.google.cloud.bigquery.StandardSQLTypeName; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class QueryMaterializedViewIT { + + private static final String ID = UUID.randomUUID().toString().substring(0, 8); + private final Logger log = Logger.getLogger(this.getClass().getName()); + private String tableName; + private String materializedViewName; + private ByteArrayOutputStream bout; + private PrintStream out; + private PrintStream originalPrintStream; + + private static final String BIGQUERY_DATASET_NAME = requireEnvVar("BIGQUERY_DATASET_NAME"); + + private static String requireEnvVar(String varName) { + String value = System.getenv(varName); + assertNotNull( + "Environment variable " + varName + " is required to perform these tests.", + System.getenv(varName)); + return value; + } + + @BeforeClass + public static void checkRequirements() { + requireEnvVar("BIGQUERY_DATASET_NAME"); + } + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + originalPrintStream = System.out; + System.setOut(out); + + tableName = "MY_TABLE_NAME_TEST_" + ID; + materializedViewName = "MY_QUERY_MATERIALIZED_VIEW_NAME_TEST_" + ID; + + Schema schema = + Schema.of( + Field.of("timestampField", StandardSQLTypeName.TIMESTAMP), + Field.of("stringField", StandardSQLTypeName.STRING), + Field.of("booleanField", StandardSQLTypeName.BOOL)); + CreateTable.createTable(BIGQUERY_DATASET_NAME, tableName, schema); + String query = + String.format( + "SELECT MAX(TimestampField) AS TimestampField, StringField, " + + "MAX(BooleanField) AS BooleanField " + + "FROM %s.%s GROUP BY StringField", + BIGQUERY_DATASET_NAME, tableName); + CreateMaterializedView.createMaterializedView( + BIGQUERY_DATASET_NAME, materializedViewName, query); + } + + @After + public void tearDown() { + // Clean up + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, materializedViewName); + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, tableName); + // restores print statements in the original method + System.out.flush(); + System.setOut(originalPrintStream); + log.log(Level.INFO, bout.toString()); + } + + @Test + public void testQueryMaterializedView() throws InterruptedException { + String query = + String.format("SELECT * FROM %s.%s", BIGQUERY_DATASET_NAME, materializedViewName); + QueryMaterializedView.queryMaterializedView(query); + assertThat(bout.toString()).contains("Query performed successfully."); + } +} From 713f59750502439661f302cd20313a54b6793162 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 1 Dec 2020 13:46:04 -0800 Subject: [PATCH 22/29] chore: regenerate README (#986) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2020-12-01 17:06:57,202 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-bigquery/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2020-12-01 17:06:58,236 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/304c654b-d069-4a1a-b811-83912b153365/targets - [ ] To automatically regenerate this PR, check this box. --- .github/readme/synth.metadata/synth.metadata | 2 +- README.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index 3f25aaa0c..252a5f81a 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "5b0c7a2fd80f571b3b128b158c403673cca722cb" + "sha": "cf36b82ef9bc0849a87b717c099321915a76b967" } }, { diff --git a/README.md b/README.md index ff1599006..01706882d 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,7 @@ has instructions for running the samples. | Query External Sheets Temp | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/QueryExternalSheetsTemp.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/QueryExternalSheetsTemp.java) | | Query External Table Aws | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/QueryExternalTableAws.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/QueryExternalTableAws.java) | | Query Large Results | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/QueryLargeResults.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/QueryLargeResults.java) | +| Query Materialized View | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/QueryMaterializedView.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/QueryMaterializedView.java) | | Query Pagination | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/QueryPagination.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/QueryPagination.java) | | Query Partitioned Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/QueryPartitionedTable.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/QueryPartitionedTable.java) | | Query Script | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/QueryScript.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/QueryScript.java) | @@ -216,6 +217,7 @@ has instructions for running the samples. | Update Dataset Description | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetDescription.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetDescription.java) | | Update Dataset Expiration | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetExpiration.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetExpiration.java) | | Update Dataset Partition Expiration | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetPartitionExpiration.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateDatasetPartitionExpiration.java) | +| Update Iam Policy | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/UpdateIamPolicy.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateIamPolicy.java) | | Update Model Description | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/UpdateModelDescription.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateModelDescription.java) | | Update Routine | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/UpdateRoutine.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateRoutine.java) | | Update Table Cmek | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/UpdateTableCmek.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigquery&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigquery/UpdateTableCmek.java) | From 3cc0d94888f649a16495f66e80ebf95093730b1a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 2 Dec 2020 22:24:09 +0100 Subject: [PATCH 23/29] deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.0 (#988) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | minor | `0.15.0` -> `0.16.0` | --- ### Release Notes
googleapis/java-shared-dependencies ### [`v0.16.0`](https://togithub.com/googleapis/java-shared-dependencies/blob/master/CHANGELOG.md#​0160-httpswwwgithubcomgoogleapisjava-shared-dependenciescompare0150v0160-2020-12-02) [Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v0.15.0...v0.16.0) ##### Dependencies - update dependency com.fasterxml.jackson:jackson-bom to v2.12.0 ([#​225](https://www.github.com/googleapis/java-shared-dependencies/issues/225)) ([b78a1ef](https://www.github.com/googleapis/java-shared-dependencies/commit/b78a1ef83ad946b0d29cd0dff46e48fbde44d120)) - update dependency com.google.api-client:google-api-client-bom to v1.31.1 ([#​215](https://www.github.com/googleapis/java-shared-dependencies/issues/215)) ([08d643a](https://www.github.com/googleapis/java-shared-dependencies/commit/08d643aaf289984b87d734274830712af82585b6)) - update dependency com.google.protobuf:protobuf-bom to v3.14.0 ([#​217](https://www.github.com/googleapis/java-shared-dependencies/issues/217)) ([01a9c64](https://www.github.com/googleapis/java-shared-dependencies/commit/01a9c6442906e8482a53712eba95ccc6f7040928)) - update dependency io.grpc:grpc-bom to v1.34.0 ([#​228](https://www.github.com/googleapis/java-shared-dependencies/issues/228)) ([425d1ea](https://www.github.com/googleapis/java-shared-dependencies/commit/425d1eab2a046c365f816f946576e4030e7c3696)) - update gax.version to v1.60.1 ([#​223](https://www.github.com/googleapis/java-shared-dependencies/issues/223)) ([84c75bd](https://www.github.com/googleapis/java-shared-dependencies/commit/84c75bdbd3f86ef7187373289ee08ad3a0c24719)) - update google.core.version to v1.94.0 ([#​212](https://www.github.com/googleapis/java-shared-dependencies/issues/212)) ([764ef5e](https://www.github.com/googleapis/java-shared-dependencies/commit/764ef5e9a2272cd9244a8fc5cc107ffacf9e9d5b))
--- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-bigquery). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bcba98036..0a598d9f8 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ google-cloud-bigquery-parent v2-rev20201030-1.30.10 - 0.15.0 + 0.16.0
From bbf4fe2565b1676567f28d720b255696328c08cc Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 2 Dec 2020 23:44:31 +0100 Subject: [PATCH 24/29] deps: update dependency com.google.cloud:google-cloud-bigtable to v1.18.1 (#989) --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index fd3f35aaa..6cbd065cf 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -63,7 +63,7 @@ com.google.cloud google-cloud-bigtable - 1.18.0 + 1.18.1 test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 945cb36f3..b65cdc676 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -61,7 +61,7 @@ com.google.cloud google-cloud-bigtable - 1.18.0 + 1.18.1 test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 8e2dbc772..02d62c95a 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -76,7 +76,7 @@ com.google.cloud google-cloud-bigtable - 1.18.0 + 1.18.1 test From 178907f65bd4162cb0172bf17439f108cafe9601 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Dec 2020 22:56:08 +0000 Subject: [PATCH 25/29] chore: release 1.125.1 (#972) :robot: I have created a release \*beep\* \*boop\* --- ### [1.125.1](https://www.github.com/googleapis/java-bigquery/compare/v1.125.0...v1.125.1) (2020-12-02) ### Bug Fixes * update listPartitions() to support tables from other projects ([#974](https://www.github.com/googleapis/java-bigquery/issues/974)) ([1739d57](https://www.github.com/googleapis/java-bigquery/commit/1739d57c59cfb6b90ccf3fcc9c07d1449fc17238)) ### Documentation * **samples:** add alter materialized view ([#979](https://www.github.com/googleapis/java-bigquery/issues/979)) ([37c0632](https://www.github.com/googleapis/java-bigquery/commit/37c0632500366006aecab18b21a10bf8956c4b6c)) * **samples:** add create external table using hivepartitioningoptions ([#969](https://www.github.com/googleapis/java-bigquery/issues/969)) ([3994be6](https://www.github.com/googleapis/java-bigquery/commit/3994be62b63b4b56944499c10b42d77ced4ab33c)) * **samples:** add create iam policy for table ([#975](https://www.github.com/googleapis/java-bigquery/issues/975)) ([0cfc98b](https://www.github.com/googleapis/java-bigquery/commit/0cfc98bffc9970d3275cc233d59c621ddbb6aea6)) * **samples:** add create materialized view ([#977](https://www.github.com/googleapis/java-bigquery/issues/977)) ([155e688](https://www.github.com/googleapis/java-bigquery/commit/155e6882aebdb4ac93e1e78baac0579ca7e11bd1)) * **samples:** add delete materialized view ([#980](https://www.github.com/googleapis/java-bigquery/issues/980)) ([022cb99](https://www.github.com/googleapis/java-bigquery/commit/022cb99b486d27c91f478353ab47df4b8e184e4a)) * **samples:** add export model ([#970](https://www.github.com/googleapis/java-bigquery/issues/970)) ([2edad15](https://www.github.com/googleapis/java-bigquery/commit/2edad15764f144268f1bd3052d1d0ac069a2f377)) * **samples:** add query materialized view ([#978](https://www.github.com/googleapis/java-bigquery/issues/978)) ([cf36b82](https://www.github.com/googleapis/java-bigquery/commit/cf36b82ef9bc0849a87b717c099321915a76b967)) * **samples:** add update iam policy for table ([#976](https://www.github.com/googleapis/java-bigquery/issues/976)) ([aeecac9](https://www.github.com/googleapis/java-bigquery/commit/aeecac905911dbe1ee534f0e5eeef2705a0cb6b3)) ### Dependencies * update dependency com.google.cloud:google-cloud-bigtable to v1.18.1 ([#989](https://www.github.com/googleapis/java-bigquery/issues/989)) ([bbf4fe2](https://www.github.com/googleapis/java-bigquery/commit/bbf4fe2565b1676567f28d720b255696328c08cc)) * update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.0 ([#988](https://www.github.com/googleapis/java-bigquery/issues/988)) ([3cc0d94](https://www.github.com/googleapis/java-bigquery/commit/3cc0d94888f649a16495f66e80ebf95093730b1a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- CHANGELOG.md | 25 +++++++++++++++++++++++++ versions.txt | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4db52034e..7516a4a0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +### [1.125.1](https://www.github.com/googleapis/java-bigquery/compare/v1.125.0...v1.125.1) (2020-12-02) + + +### Bug Fixes + +* update listPartitions() to support tables from other projects ([#974](https://www.github.com/googleapis/java-bigquery/issues/974)) ([1739d57](https://www.github.com/googleapis/java-bigquery/commit/1739d57c59cfb6b90ccf3fcc9c07d1449fc17238)) + + +### Documentation + +* **samples:** add alter materialized view ([#979](https://www.github.com/googleapis/java-bigquery/issues/979)) ([37c0632](https://www.github.com/googleapis/java-bigquery/commit/37c0632500366006aecab18b21a10bf8956c4b6c)) +* **samples:** add create external table using hivepartitioningoptions ([#969](https://www.github.com/googleapis/java-bigquery/issues/969)) ([3994be6](https://www.github.com/googleapis/java-bigquery/commit/3994be62b63b4b56944499c10b42d77ced4ab33c)) +* **samples:** add create iam policy for table ([#975](https://www.github.com/googleapis/java-bigquery/issues/975)) ([0cfc98b](https://www.github.com/googleapis/java-bigquery/commit/0cfc98bffc9970d3275cc233d59c621ddbb6aea6)) +* **samples:** add create materialized view ([#977](https://www.github.com/googleapis/java-bigquery/issues/977)) ([155e688](https://www.github.com/googleapis/java-bigquery/commit/155e6882aebdb4ac93e1e78baac0579ca7e11bd1)) +* **samples:** add delete materialized view ([#980](https://www.github.com/googleapis/java-bigquery/issues/980)) ([022cb99](https://www.github.com/googleapis/java-bigquery/commit/022cb99b486d27c91f478353ab47df4b8e184e4a)) +* **samples:** add export model ([#970](https://www.github.com/googleapis/java-bigquery/issues/970)) ([2edad15](https://www.github.com/googleapis/java-bigquery/commit/2edad15764f144268f1bd3052d1d0ac069a2f377)) +* **samples:** add query materialized view ([#978](https://www.github.com/googleapis/java-bigquery/issues/978)) ([cf36b82](https://www.github.com/googleapis/java-bigquery/commit/cf36b82ef9bc0849a87b717c099321915a76b967)) +* **samples:** add update iam policy for table ([#976](https://www.github.com/googleapis/java-bigquery/issues/976)) ([aeecac9](https://www.github.com/googleapis/java-bigquery/commit/aeecac905911dbe1ee534f0e5eeef2705a0cb6b3)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-bigtable to v1.18.1 ([#989](https://www.github.com/googleapis/java-bigquery/issues/989)) ([bbf4fe2](https://www.github.com/googleapis/java-bigquery/commit/bbf4fe2565b1676567f28d720b255696328c08cc)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.0 ([#988](https://www.github.com/googleapis/java-bigquery/issues/988)) ([3cc0d94](https://www.github.com/googleapis/java-bigquery/commit/3cc0d94888f649a16495f66e80ebf95093730b1a)) + ## [1.125.0](https://www.github.com/googleapis/java-bigquery/compare/v1.124.7...v1.125.0) (2020-11-19) diff --git a/versions.txt b/versions.txt index bbaa41b16..c9165863c 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:1.125.0:1.125.1-SNAPSHOT \ No newline at end of file +google-cloud-bigquery:1.125.1:1.125.1 \ No newline at end of file From 120a48d0fb464d258adda5d3c5bd0464212a9c89 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2020 09:32:02 +0000 Subject: [PATCH 26/29] chore: release 1.125.2-SNAPSHOT (#991) :robot: I have created a release \*beep\* \*boop\* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index edebf7205..c3bf7d724 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 1.125.1-SNAPSHOT + 1.125.2-SNAPSHOT diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index c8d70ec7c..0d2925fbf 100644 --- a/google-cloud-bigquery/pom.xml +++ b/google-cloud-bigquery/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigquery - 1.125.1-SNAPSHOT + 1.125.2-SNAPSHOT jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 1.125.1-SNAPSHOT + 1.125.2-SNAPSHOT google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 0a598d9f8..3dcbff5d7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 1.125.1-SNAPSHOT + 1.125.2-SNAPSHOT BigQuery Parent https://github.com/googleapis/java-bigquery @@ -87,7 +87,7 @@ com.google.cloud google-cloud-bigquery - 1.125.1-SNAPSHOT + 1.125.2-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index b65cdc676..02f4425df 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 1.125.1-SNAPSHOT + 1.125.2-SNAPSHOT diff --git a/versions.txt b/versions.txt index c9165863c..f43ea6fd9 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:1.125.1:1.125.1 \ No newline at end of file +google-cloud-bigquery:1.125.1:1.125.2-SNAPSHOT \ No newline at end of file From fc8774698be60ea567a4d0be5cc3c2a57a75bd99 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 4 Dec 2020 20:25:48 +0100 Subject: [PATCH 27/29] deps: update dependency com.google.cloud:google-cloud-bigtable to v1.19.0 (#993) --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 6cbd065cf..71219c672 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -63,7 +63,7 @@ com.google.cloud google-cloud-bigtable - 1.18.1 + 1.19.0 test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 02f4425df..c88171b91 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -61,7 +61,7 @@ com.google.cloud google-cloud-bigtable - 1.18.1 + 1.19.0 test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 02d62c95a..c9f01391c 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -76,7 +76,7 @@ com.google.cloud google-cloud-bigtable - 1.18.1 + 1.19.0 test From 8968b44ceb9fa9a199257a5cb8434069d4fdc4b6 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 4 Dec 2020 23:46:10 +0100 Subject: [PATCH 28/29] deps: update dependency com.google.apis:google-api-services-bigquery to v2-rev20201030-1.31.0 (#995) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3dcbff5d7..7e79d268a 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,7 @@ UTF-8 github google-cloud-bigquery-parent - v2-rev20201030-1.30.10 + v2-rev20201030-1.31.0 0.16.0 From 968e72f657a190232dd67ddc668b7666b94f18bb Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2020 22:58:03 +0000 Subject: [PATCH 29/29] chore: release 1.125.2 (#994) :robot: I have created a release \*beep\* \*boop\* --- ### [1.125.2](https://www.github.com/googleapis/java-bigquery/compare/v1.125.1...v1.125.2) (2020-12-04) ### Dependencies * update dependency com.google.apis:google-api-services-bigquery to v2-rev20201030-1.31.0 ([#995](https://www.github.com/googleapis/java-bigquery/issues/995)) ([8968b44](https://www.github.com/googleapis/java-bigquery/commit/8968b44ceb9fa9a199257a5cb8434069d4fdc4b6)) * update dependency com.google.cloud:google-cloud-bigtable to v1.19.0 ([#993](https://www.github.com/googleapis/java-bigquery/issues/993)) ([fc87746](https://www.github.com/googleapis/java-bigquery/commit/fc8774698be60ea567a4d0be5cc3c2a57a75bd99)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- CHANGELOG.md | 8 ++++++++ benchmark/pom.xml | 2 +- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7516a4a0c..51fffe056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [1.125.2](https://www.github.com/googleapis/java-bigquery/compare/v1.125.1...v1.125.2) (2020-12-04) + + +### Dependencies + +* update dependency com.google.apis:google-api-services-bigquery to v2-rev20201030-1.31.0 ([#995](https://www.github.com/googleapis/java-bigquery/issues/995)) ([8968b44](https://www.github.com/googleapis/java-bigquery/commit/8968b44ceb9fa9a199257a5cb8434069d4fdc4b6)) +* update dependency com.google.cloud:google-cloud-bigtable to v1.19.0 ([#993](https://www.github.com/googleapis/java-bigquery/issues/993)) ([fc87746](https://www.github.com/googleapis/java-bigquery/commit/fc8774698be60ea567a4d0be5cc3c2a57a75bd99)) + ### [1.125.1](https://www.github.com/googleapis/java-bigquery/compare/v1.125.0...v1.125.1) (2020-12-02) diff --git a/benchmark/pom.xml b/benchmark/pom.xml index c3bf7d724..c19ef3179 100644 --- a/benchmark/pom.xml +++ b/benchmark/pom.xml @@ -6,7 +6,7 @@ google-cloud-bigquery-parent com.google.cloud - 1.125.2-SNAPSHOT + 1.125.2 diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index 0d2925fbf..6102375d8 100644 --- a/google-cloud-bigquery/pom.xml +++ b/google-cloud-bigquery/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigquery - 1.125.2-SNAPSHOT + 1.125.2 jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 1.125.2-SNAPSHOT + 1.125.2 google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 7e79d268a..cd1be261c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 1.125.2-SNAPSHOT + 1.125.2 BigQuery Parent https://github.com/googleapis/java-bigquery @@ -87,7 +87,7 @@ com.google.cloud google-cloud-bigquery - 1.125.2-SNAPSHOT + 1.125.2 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index c88171b91..6676e7223 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 1.125.2-SNAPSHOT + 1.125.2 diff --git a/versions.txt b/versions.txt index f43ea6fd9..40fa442b2 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:1.125.1:1.125.2-SNAPSHOT \ No newline at end of file +google-cloud-bigquery:1.125.2:1.125.2 \ No newline at end of file