From 2ee010cdffb6ed3bdae54d77d63bfb41eace3098 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 10 Jun 2020 08:20:06 -0700 Subject: [PATCH 01/23] deps: bump libraries-bom version (#434) autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- README.md | 2 +- synth.metadata | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 595ea6dfa..9699fc561 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ See https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google com.google.cloud libraries-bom - 5.5.0 + 5.6.0 pom import diff --git a/synth.metadata b/synth.metadata index 773d2cf67..82e1c7693 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "21a3606f5fb65287f808b12a6fef65817c8a8ba6" + "sha": "5b33b18588c6f44f71d895c9811f52b97661fb4d" } }, { From 73c94bb134d902e30ca3cd30f94550850fa9aa01 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 10 Jun 2020 17:20:22 +0200 Subject: [PATCH 02/23] chore(deps): update dependency com.google.cloud.samples:shared-configuration to v1.0.18 (#435) --- samples/install-without-bom/pom.xml | 2 +- samples/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 5233a01d9..5aef3783a 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -30,7 +30,7 @@ com.google.cloud.samples shared-configuration - 1.0.17 + 1.0.18 diff --git a/samples/pom.xml b/samples/pom.xml index 6c4687174..ce09b2f3a 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -34,7 +34,7 @@ com.google.cloud.samples shared-configuration - 1.0.17 + 1.0.18 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 58b94a0c6..a12560e3e 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -30,7 +30,7 @@ com.google.cloud.samples shared-configuration - 1.0.17 + 1.0.18 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 67bb701ec..e0505af78 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -26,7 +26,7 @@ com.google.cloud.samples shared-configuration - 1.0.17 + 1.0.18 From cd714d5cba70c38ff90e1a5d5c562f8305fe1835 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 10 Jun 2020 17:20:38 +0200 Subject: [PATCH 03/23] build(deps): update dependency com.google.cloud:google-cloud-shared-config to v0.7.0 (#436) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 76269f9ca..440bc757a 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 0.6.0 + 0.7.0 From ecc0095f2ef98323bab2da9e4783a2889e12a4f6 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 10 Jun 2020 15:28:07 +0000 Subject: [PATCH 04/23] chore: release 1.116.3-SNAPSHOT (#437) :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). --- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index 6a8352473..96fbb4195 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.116.2 + 1.116.3-SNAPSHOT jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 1.116.2 + 1.116.3-SNAPSHOT google-cloud-bigquery diff --git a/pom.xml b/pom.xml index 440bc757a..f28e46572 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 1.116.2 + 1.116.3-SNAPSHOT BigQuery Parent https://github.com/googleapis/java-bigquery @@ -86,7 +86,7 @@ com.google.cloud google-cloud-bigquery - 1.116.2 + 1.116.3-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index a12560e3e..82f81b554 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 1.116.2 + 1.116.3-SNAPSHOT diff --git a/versions.txt b/versions.txt index 2ca5a2c2f..d3268fe4d 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:1.116.2:1.116.2 \ No newline at end of file +google-cloud-bigquery:1.116.2:1.116.3-SNAPSHOT \ No newline at end of file From 0a52a298206daf0c44d033c9b412da067f43c282 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 10 Jun 2020 18:01:26 +0200 Subject: [PATCH 05/23] chore(deps): update dependency com.google.cloud:google-cloud-bigquery to v1.116.2 (#433) --- 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 5aef3783a..4a1098aa6 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.116.1 + 1.116.2 From 92dbcb093a772eb0258204e0ae04287eaf03f2fc Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 11 Jun 2020 00:48:50 +0200 Subject: [PATCH 06/23] chore(deps): update dependency com.google.cloud:libraries-bom to v5.7.0 (#440) --- samples/snippets/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index e0505af78..df8f1c1b5 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -44,7 +44,7 @@ com.google.cloud libraries-bom - 5.6.0 + 5.7.0 pom import From 59ac5284ca76a6d4ec560d9b0a73f6382e1f888a Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 10 Jun 2020 15:49:06 -0700 Subject: [PATCH 07/23] changes without context (#441) autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- README.md | 2 +- synth.metadata | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9699fc561..761e3e767 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.116.1 + 1.116.2 ``` diff --git a/synth.metadata b/synth.metadata index 82e1c7693..caf6c0ab5 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "5b33b18588c6f44f71d895c9811f52b97661fb4d" + "sha": "0a52a298206daf0c44d033c9b412da067f43c282" } }, { From 4a7e342ff522e0dd17356b29c3ac3cd7c445c9fc Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 11 Jun 2020 02:06:16 +0200 Subject: [PATCH 08/23] build(deps): update dependency com.google.cloud:google-cloud-shared-config to v0.8.0 (#442) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [com.google.cloud:google-cloud-shared-config](https://togithub.com/googleapis/java-shared-config) | minor | `0.7.0` -> `0.8.0` | --- ### Release Notes
googleapis/java-shared-config ### [`v0.8.0`](https://togithub.com/googleapis/java-shared-config/blob/master/CHANGELOG.md#​080-httpswwwgithubcomgoogleapisjava-shared-configcomparev070v080-2020-06-10) [Compare Source](https://togithub.com/googleapis/java-shared-config/compare/v0.7.0...v0.8.0) ##### Features - revert "feat: mark auto-value-annotations scope as provided" ([#​154](https://www.github.com/googleapis/java-shared-config/issues/154)) ([88afb4e](https://www.github.com/googleapis/java-shared-config/commit/88afb4e7c57cb6e00929c098135314a926d9da30))
--- ### 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#googleapis/java-bigquery). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f28e46572..77414196e 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 0.7.0 + 0.8.0 From 86c4d470e493344126da4213e3be105234c36c5b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 11 Jun 2020 08:00:48 -0700 Subject: [PATCH 09/23] chore: bump libraries-bom version in readme (#443) autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- README.md | 2 +- synth.metadata | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 761e3e767..9c9d3efeb 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ See https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google com.google.cloud libraries-bom - 5.6.0 + 5.7.0 pom import diff --git a/synth.metadata b/synth.metadata index caf6c0ab5..d349203ea 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "0a52a298206daf0c44d033c9b412da067f43c282" + "sha": "4a7e342ff522e0dd17356b29c3ac3cd7c445c9fc" } }, { From 1f2846c5d0ca43655bdeb223b9d62de1f88fe4b9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 15 Jun 2020 18:13:14 +0200 Subject: [PATCH 10/23] deps: update dependency com.google.cloud:google-cloud-storage to v1.109.0 (#446) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 77414196e..c3c4f2cbf 100644 --- a/pom.xml +++ b/pom.xml @@ -117,7 +117,7 @@ com.google.cloud google-cloud-storage - 1.108.0 + 1.109.0 test From f53559e376ff8ebcca7440b977c02feb9b52a64b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 15 Jun 2020 18:13:31 +0200 Subject: [PATCH 11/23] deps: update dependency com.google.apis:google-api-services-bigquery to v2-rev20200603-1.30.9 (#447) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c3c4f2cbf..66ba63256 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,7 @@ UTF-8 github google-cloud-bigquery-parent - v2-rev20200523-1.30.9 + v2-rev20200603-1.30.9
From 8af668e2b5e9028cabe70740ea1baa624d35b7c0 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 15 Jun 2020 18:13:46 +0200 Subject: [PATCH 12/23] deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.1 (#448) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 66ba63256..cf419a542 100644 --- a/pom.xml +++ b/pom.xml @@ -72,7 +72,7 @@ com.google.cloud google-cloud-shared-dependencies - 0.7.0 + 0.8.1 pom import From dbb66393219addabe917c744d727bed57a32c156 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 15 Jun 2020 22:21:24 +0200 Subject: [PATCH 13/23] build(deps): update dependency com.google.cloud:google-cloud-shared-config to v0.8.1 (#449) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cf419a542..10cbd3bc5 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 0.8.0 + 0.8.1 From 01dd6be4f8894d11124f6e68545aa3b3b3ee14d8 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 16 Jun 2020 11:04:09 +0200 Subject: [PATCH 14/23] deps: update dependency com.google.cloud:google-cloud-storage to v1.109.1 (#453) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [com.google.cloud:google-cloud-storage](https://togithub.com/googleapis/java-storage) | patch | `1.109.0` -> `1.109.1` | --- ### Release Notes
googleapis/java-storage ### [`v1.109.1`](https://togithub.com/googleapis/java-storage/blob/master/CHANGELOG.md#​11091-httpswwwgithubcomgoogleapisjava-storagecomparev11090v11091-2020-06-15) [Compare Source](https://togithub.com/googleapis/java-storage/compare/v1.109.0...v1.109.1)
--- ### 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#googleapis/java-bigquery). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 10cbd3bc5..a484ce5a2 100644 --- a/pom.xml +++ b/pom.xml @@ -117,7 +117,7 @@ com.google.cloud google-cloud-storage - 1.109.0 + 1.109.1 test From 8b6835fe0daa5749e10e59eab3a3013825534421 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 16 Jun 2020 12:18:28 -0700 Subject: [PATCH 15/23] ci: switch to secret manager for samples/integration tests (#454) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/2c593734-539a-435d-8a04-27f04c90082f/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: https://github.com/googleapis/synthtool/commit/c4f3059c27591eb24d6942a0e357ec94c80459f2 Source-Link: https://github.com/googleapis/synthtool/commit/6eb80fa9f96433af8dbeb1c8323aa80cda49b374 Source-Link: https://github.com/googleapis/synthtool/commit/6d3eed67a45fd58f9c7bfa173c32e4fd4fed058f Source-Link: https://github.com/googleapis/synthtool/commit/d1addcdf80aa9ddef8c932c89c919024bbad7af3 --- .kokoro/build.sh | 2 +- .kokoro/nightly/integration.cfg | 12 +++------ .kokoro/nightly/samples.cfg | 16 +++++------- .kokoro/populate-secrets.sh | 43 +++++++++++++++++++++++++++++++ .kokoro/presubmit/integration.cfg | 12 +++------ .kokoro/presubmit/samples.cfg | 14 ++++------ .kokoro/trampoline.sh | 2 ++ synth.metadata | 4 +-- 8 files changed, 67 insertions(+), 38 deletions(-) create mode 100755 .kokoro/populate-secrets.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh index c4b20b9f9..22c0237b1 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -39,7 +39,7 @@ retry_with_backoff 3 10 \ # if GOOGLE_APPLICATION_CREDIENTIALS is specified as a relative path prepend Kokoro root directory onto it if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then - export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_ROOT}/src/${GOOGLE_APPLICATION_CREDENTIALS}) + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) fi RETURN_CODE=0 diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg index 40c4abb7b..0048c8ece 100644 --- a/.kokoro/nightly/integration.cfg +++ b/.kokoro/nightly/integration.cfg @@ -28,14 +28,10 @@ env_vars: { env_vars: { key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "keystore/73713_java_it_service_account" + value: "secret_manager/java-it-service-account" } -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "java_it_service_account" - } - } +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" } diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg index 20aabd55d..f25429314 100644 --- a/.kokoro/nightly/samples.cfg +++ b/.kokoro/nightly/samples.cfg @@ -24,19 +24,15 @@ env_vars: { env_vars: { key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "keystore/73713_java_it_service_account" + value: "secret_manager/java-docs-samples-service-account" } env_vars: { - key: "ENABLE_BUILD_COP" - value: "true" + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" } -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "java_it_service_account" - } - } +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" } diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh new file mode 100755 index 000000000..f52514257 --- /dev/null +++ b/.kokoro/populate-secrets.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# 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. + +set -eo pipefail + +function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} +function msg { println "$*" >&2 ;} +function println { printf '%s\n' "$(now) $*" ;} + + +# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: +# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com +SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" +msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" +mkdir -p ${SECRET_LOCATION} +for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") +do + msg "Retrieving secret ${key}" + docker run --entrypoint=gcloud \ + --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ + gcr.io/google.com/cloudsdktool/cloud-sdk \ + secrets versions access latest \ + --project cloud-devrel-kokoro-resources \ + --secret ${key} > \ + "${SECRET_LOCATION}/${key}" + if [[ $? == 0 ]]; then + msg "Secret written to ${SECRET_LOCATION}/${key}" + else + msg "Error retrieving secret ${key}" + fi +done diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg index 522e5b101..dded67a9d 100644 --- a/.kokoro/presubmit/integration.cfg +++ b/.kokoro/presubmit/integration.cfg @@ -24,14 +24,10 @@ env_vars: { env_vars: { key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "keystore/73713_java_it_service_account" + value: "secret_manager/java-it-service-account" } -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "java_it_service_account" - } - } +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" } diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg index 1171aead0..01e096004 100644 --- a/.kokoro/presubmit/samples.cfg +++ b/.kokoro/presubmit/samples.cfg @@ -24,14 +24,10 @@ env_vars: { env_vars: { key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "keystore/73713_java_it_service_account" + value: "secret_manager/java-docs-samples-service-account" } -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "java_it_service_account" - } - } -} +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh index ba17ce014..9da0f8398 100644 --- a/.kokoro/trampoline.sh +++ b/.kokoro/trampoline.sh @@ -21,4 +21,6 @@ function cleanup() { echo "cleanup"; } trap cleanup EXIT + +$(dirname $0)/populate-secrets.sh # Secret Manager secrets. python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/synth.metadata b/synth.metadata index d349203ea..3a890effd 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "4a7e342ff522e0dd17356b29c3ac3cd7c445c9fc" + "sha": "01dd6be4f8894d11124f6e68545aa3b3b3ee14d8" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "987270824bd26f6a8c716d5e2022057b8ae7b26e" + "sha": "c4f3059c27591eb24d6942a0e357ec94c80459f2" } } ] From d16a3b5e928ceeed1c227d5bfa72509da24217ed Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 17 Jun 2020 01:30:10 +0200 Subject: [PATCH 16/23] chore(deps): update dependency com.google.cloud:libraries-bom to v6 (#455) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [com.google.cloud:libraries-bom](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java) | major | `5.7.0` -> `6.0.0` | --- ### 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#googleapis/java-bigquery). --- samples/snippets/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index df8f1c1b5..186c6874a 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -44,7 +44,7 @@ com.google.cloud libraries-bom - 5.7.0 + 6.0.0 pom import From 16738bed6a683f9b48bac33dcb1f0448394593b4 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 17 Jun 2020 08:08:04 -0700 Subject: [PATCH 17/23] chore: bump libraries-bom version (#457) autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- README.md | 2 +- synth.metadata | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9c9d3efeb..53f8fa712 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ See https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google com.google.cloud libraries-bom - 5.7.0 + 6.0.0 pom import diff --git a/synth.metadata b/synth.metadata index 3a890effd..e3b4e49a7 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "01dd6be4f8894d11124f6e68545aa3b3b3ee14d8" + "sha": "d16a3b5e928ceeed1c227d5bfa72509da24217ed" } }, { From 53e0c788e09483b67d9d34443cb00b4046da9f5c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 17 Jun 2020 18:15:56 +0200 Subject: [PATCH 18/23] chore(deps): update dependency com.google.cloud:libraries-bom to v7 (#459) --- samples/snippets/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 186c6874a..d34a996f9 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -44,7 +44,7 @@ com.google.cloud libraries-bom - 6.0.0 + 7.0.0 pom import From 68140d5e463304253a5cc28e6dae9cc73d1bf8d1 Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Wed, 17 Jun 2020 22:47:33 +0530 Subject: [PATCH 19/23] docs(samples): add create range partition table (#458) * docs(samples): add create range partition table * docs(samples): address feedback --- .../bigquery/CreateRangePartitionedTable.java | 83 +++++++++++++++++++ .../CreateRangePartitionedTableIT.java | 83 +++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/CreateRangePartitionedTable.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/CreateRangePartitionedTableIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/CreateRangePartitionedTable.java b/samples/snippets/src/main/java/com/example/bigquery/CreateRangePartitionedTable.java new file mode 100644 index 000000000..57abdff8f --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/CreateRangePartitionedTable.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; + +// [START bigquery_create_table_range_partitioned] +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.Field; +import com.google.cloud.bigquery.RangePartitioning; +import com.google.cloud.bigquery.Schema; +import com.google.cloud.bigquery.StandardSQLTypeName; +import com.google.cloud.bigquery.StandardTableDefinition; +import com.google.cloud.bigquery.TableId; +import com.google.cloud.bigquery.TableInfo; + +// Sample to create a range partitioned table +public class CreateRangePartitionedTable { + + public static void runCreateRangePartitionedTable() { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String tableName = "MY_TABLE_NAME"; + Schema schema = + Schema.of( + Field.of("integerField", StandardSQLTypeName.INT64), + Field.of("stringField", StandardSQLTypeName.STRING), + Field.of("booleanField", StandardSQLTypeName.BOOL), + Field.of("dateField", StandardSQLTypeName.DATE)); + createRangePartitionedTable(datasetName, tableName, schema); + } + + public static void createRangePartitionedTable( + String datasetName, String tableName, Schema schema) { + 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); + + // Note: The field must be a top- level, NULLABLE/REQUIRED field. + // The only supported type is INTEGER/INT64 + RangePartitioning partitioning = + RangePartitioning.newBuilder() + .setField("integerField") + .setRange( + RangePartitioning.Range.newBuilder() + .setStart(1L) + .setInterval(2L) + .setEnd(10L) + .build()) + .build(); + + StandardTableDefinition tableDefinition = + StandardTableDefinition.newBuilder() + .setSchema(schema) + .setRangePartitioning(partitioning) + .build(); + TableInfo tableInfo = TableInfo.newBuilder(tableId, tableDefinition).build(); + + bigquery.create(tableInfo); + System.out.println("Range partitioned table created successfully"); + } catch (BigQueryException e) { + System.out.println("Range partitioned table was not created. \n" + e.toString()); + } + } +} +// [END bigquery_create_table_range_partitioned] diff --git a/samples/snippets/src/test/java/com/example/bigquery/CreateRangePartitionedTableIT.java b/samples/snippets/src/test/java/com/example/bigquery/CreateRangePartitionedTableIT.java new file mode 100644 index 000000000..a07497849 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/CreateRangePartitionedTableIT.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.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 org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CreateRangePartitionedTableIT { + + private String tableName; + private ByteArrayOutputStream bout; + private PrintStream out; + + 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() { + tableName = "RANGE_PARTITIONED_TABLE_TEST" + UUID.randomUUID().toString().replace('-', '_'); + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + // Clean up + DeleteTable.deleteTable(BIGQUERY_DATASET_NAME, tableName); + System.setOut(null); + } + + @Test + public void testCreateRangePartitionedTable() { + Schema schema = + Schema.of( + Field.of("integerField", StandardSQLTypeName.INT64), + Field.of("stringField", StandardSQLTypeName.STRING), + Field.of("booleanField", StandardSQLTypeName.BOOL), + Field.of("dateField", StandardSQLTypeName.DATE)); + + CreateRangePartitionedTable.createRangePartitionedTable( + BIGQUERY_DATASET_NAME, tableName, schema); + + assertThat(bout.toString()).contains("Range partitioned table created successfully"); + } +} From e5db01cac9309d0d2da819276d69af017c367929 Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Thu, 18 Jun 2020 20:58:35 +0530 Subject: [PATCH 20/23] docs(samples): add query (#463) * docs(samples): add query * docs(samples): add comment --- .../main/java/com/example/bigquery/Query.java | 70 +++++++++++++++++++ .../java/com/example/bigquery/QueryIT.java | 57 +++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/Query.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/QueryIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/Query.java b/samples/snippets/src/main/java/com/example/bigquery/Query.java new file mode 100644 index 000000000..d9794e6c6 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/Query.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_query] +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; + +// Sample to query in a table +public class Query { + + public static void runQuery() { + // TODO(developer): Replace these variables before running the sample. + String projectId = "MY_PROJECT_ID"; + String datasetName = "MY_DATASET_NAME"; + String tableName = "MY_TABLE_NAME"; + String query = + "SELECT name, SUM(number) as total_people\n" + + " FROM `" + + projectId + + "." + + datasetName + + "." + + tableName + + "`" + + " WHERE state = 'TX'" + + " GROUP BY name, state" + + " ORDER BY total_people DESC" + + " LIMIT 20"; + query(query); + } + + public static void query(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(); + + QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query).build(); + + TableResult results = bigquery.query(queryConfig); + + results + .iterateAll() + .forEach(row -> row.forEach(val -> System.out.printf("%s,", val.toString()))); + + System.out.println("Query performed successfully."); + } catch (BigQueryException | InterruptedException e) { + System.out.println("Query not performed \n" + e.toString()); + } + } +} +// [END bigquery_query] diff --git a/samples/snippets/src/test/java/com/example/bigquery/QueryIT.java b/samples/snippets/src/test/java/com/example/bigquery/QueryIT.java new file mode 100644 index 000000000..36e59b67a --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/QueryIT.java @@ -0,0 +1,57 @@ +/* + * 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 java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class QueryIT { + + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + System.setOut(null); + } + + @Test + public void testQuery() { + String query = + "SELECT name, SUM(number) as total_people" + + " FROM `bigquery-public-data.usa_names.usa_1910_2013`" + + " WHERE state = 'TX'" + + " GROUP BY name, state" + + " ORDER BY total_people DESC" + + " LIMIT 20"; + + Query.query(query); + assertThat(bout.toString()).contains("Query performed successfully."); + } +} From df6479f2243193e692313790cbb1720d0279d47a Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Thu, 18 Jun 2020 23:20:10 +0530 Subject: [PATCH 21/23] docs(samples): add create and delete model (#462) * docs(samples): add create and delete model * docs(samples): fix flaky test * docs(samples): fix npe --- .../com/example/bigquery/CreateModel.java | 74 +++++++++++++++ .../com/example/bigquery/DeleteModel.java | 51 ++++++++++ .../com/example/bigquery/CreateModelIT.java | 87 +++++++++++++++++ .../com/example/bigquery/DeleteModelIT.java | 93 +++++++++++++++++++ 4 files changed, 305 insertions(+) create mode 100644 samples/snippets/src/main/java/com/example/bigquery/CreateModel.java create mode 100644 samples/snippets/src/main/java/com/example/bigquery/DeleteModel.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/CreateModelIT.java create mode 100644 samples/snippets/src/test/java/com/example/bigquery/DeleteModelIT.java diff --git a/samples/snippets/src/main/java/com/example/bigquery/CreateModel.java b/samples/snippets/src/main/java/com/example/bigquery/CreateModel.java new file mode 100644 index 000000000..d7ebe2c28 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/CreateModel.java @@ -0,0 +1,74 @@ +/* + * 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_model] +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.Job; +import com.google.cloud.bigquery.JobInfo; +import com.google.cloud.bigquery.QueryJobConfiguration; + +// Sample to create a model +public class CreateModel { + + public static void runCreateModel() { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String modelName = "MY_MODEL_NAME"; + String sql = + "CREATE MODEL `" + + datasetName + + "." + + modelName + + "`" + + "OPTIONS ( " + + "model_type='linear_reg', " + + "max_iteration=1, " + + "learn_rate=0.4, " + + "learn_rate_strategy='constant' " + + ") AS ( " + + " SELECT 'a' AS f1, 2.0 AS label " + + "UNION ALL " + + "SELECT 'b' AS f1, 3.8 AS label " + + ")"; + createModel(sql); + } + + public static void createModel(String sql) { + 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(); + + QueryJobConfiguration config = QueryJobConfiguration.newBuilder(sql).build(); + + // create a model using query and it will wait to complete job. + Job job = bigquery.create(JobInfo.of(config)); + job = job.waitFor(); + if (job.isDone()) { + System.out.println("Model created successfully"); + } else { + System.out.println("Model was not created"); + } + } catch (BigQueryException | InterruptedException e) { + System.out.println("Model was not created. \n" + e.toString()); + } + } +} +// [END bigquery_create_model] diff --git a/samples/snippets/src/main/java/com/example/bigquery/DeleteModel.java b/samples/snippets/src/main/java/com/example/bigquery/DeleteModel.java new file mode 100644 index 000000000..dbf3bb0a6 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigquery/DeleteModel.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; + +// [START bigquery_delete_model] +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryException; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.ModelId; + +// Sample to delete a model +public class DeleteModel { + + public static void runDeleteModel() { + // TODO(developer): Replace these variables before running the sample. + String datasetName = "MY_DATASET_NAME"; + String modelName = "MY_MODEL_NAME"; + deleteModel(datasetName, modelName); + } + + public static void deleteModel(String datasetName, String modelName) { + 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(); + boolean success = bigquery.delete(ModelId.of(datasetName, modelName)); + if (success) { + System.out.println("Model deleted successfully"); + } else { + System.out.println("Model was not found"); + } + } catch (BigQueryException e) { + System.out.println("Model was not deleted. \n" + e.toString()); + } + } +} +// [END bigquery_delete_model] diff --git a/samples/snippets/src/test/java/com/example/bigquery/CreateModelIT.java b/samples/snippets/src/test/java/com/example/bigquery/CreateModelIT.java new file mode 100644 index 000000000..b0bcb7ca6 --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/CreateModelIT.java @@ -0,0 +1,87 @@ +/* + * 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 org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CreateModelIT { + + private String modelName; + private ByteArrayOutputStream bout; + private PrintStream out; + + 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() { + modelName = "MY_MODEL_NAME_TEST_" + UUID.randomUUID().toString().replace('-', '_'); + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + // Clean up + DeleteModel.deleteModel(BIGQUERY_DATASET_NAME, modelName); + System.setOut(null); + } + + @Test + public void testCreateModel() { + String sql = + "CREATE MODEL `" + + BIGQUERY_DATASET_NAME + + "." + + modelName + + "`" + + "OPTIONS ( " + + "model_type='linear_reg', " + + "max_iteration=1, " + + "learn_rate=0.4, " + + "learn_rate_strategy='constant' " + + ") AS ( " + + " SELECT 'a' AS f1, 2.0 AS label " + + "UNION ALL " + + "SELECT 'b' AS f1, 3.8 AS label " + + ")"; + CreateModel.createModel(sql); + assertThat(bout.toString()).contains("Model created successfully"); + } +} diff --git a/samples/snippets/src/test/java/com/example/bigquery/DeleteModelIT.java b/samples/snippets/src/test/java/com/example/bigquery/DeleteModelIT.java new file mode 100644 index 000000000..1933a3a7a --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigquery/DeleteModelIT.java @@ -0,0 +1,93 @@ +/* + * 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 org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class DeleteModelIT { + + private String modelName; + private ByteArrayOutputStream bout; + private PrintStream out; + + 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); + System.setOut(out); + + // Create a new model to be deleted + modelName = "MY_MODEL_NAME_TEST_" + UUID.randomUUID().toString().substring(0, 8); + String sql = + "CREATE MODEL `" + + BIGQUERY_DATASET_NAME + + "." + + modelName + + "`" + + "OPTIONS ( " + + "model_type='linear_reg', " + + "max_iteration=1, " + + "learn_rate=0.4, " + + "learn_rate_strategy='constant' " + + ") AS ( " + + " SELECT 'a' AS f1, 2.0 AS label " + + "UNION ALL " + + "SELECT 'b' AS f1, 3.8 AS label " + + ")"; + CreateModel.createModel(sql); + + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + System.setOut(null); + } + + @Test + public void testDeleteModel() { + // Delete the model that was just created + DeleteModel.deleteModel(BIGQUERY_DATASET_NAME, modelName); + assertThat(bout.toString()).contains("Model deleted successfully"); + } +} From 3dc0fd8809b504e5be82b2616b1203e366ea5bc5 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 18 Jun 2020 10:50:34 -0700 Subject: [PATCH 22/23] chore: bump libraries-bom version (#461) autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- README.md | 3 ++- synth.metadata | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53f8fa712..75cb6c14c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ See https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google com.google.cloud libraries-bom - 6.0.0 + 7.0.0 pom import @@ -210,6 +210,7 @@ has instructions for running the samples. | Create Clustered Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateClusteredTable.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/CreateClusteredTable.java) | | 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 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) | | Create Table | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/CreateTable.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/CreateTable.java) | | Delete Dataset | [source code](https://github.com/googleapis/java-bigquery/blob/master/samples/snippets/src/main/java/com/example/bigquery/DeleteDataset.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/DeleteDataset.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) | diff --git a/synth.metadata b/synth.metadata index e3b4e49a7..994bf5a86 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "d16a3b5e928ceeed1c227d5bfa72509da24217ed" + "sha": "68140d5e463304253a5cc28e6dae9cc73d1bf8d1" } }, { From c41426b011d89ff1380e16f47319cf8100bf7a14 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 18 Jun 2020 16:45:09 -0400 Subject: [PATCH 23/23] chore: release 1.116.4 (#450) * updated CHANGELOG.md [ci skip] * updated README.md [ci skip] * updated versions.txt [ci skip] * updated samples/pom.xml [ci skip] * updated samples/install-without-bom/pom.xml [ci skip] * updated google-cloud-bigquery/pom.xml [ci skip] * updated samples/snapshot/pom.xml [ci skip] * updated pom.xml [ci skip] * updated samples/snippets/pom.xml Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 16 ++++++++++++++++ README.md | 4 ++-- google-cloud-bigquery/pom.xml | 4 ++-- pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be9f692b6..93accf7f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +### [1.116.4](https://www.github.com/googleapis/java-bigquery/compare/v1.116.3...v1.116.4) (2020-06-18) + + +### Documentation + +* **samples:** add create and delete model ([#462](https://www.github.com/googleapis/java-bigquery/issues/462)) ([df6479f](https://www.github.com/googleapis/java-bigquery/commit/df6479f2243193e692313790cbb1720d0279d47a)) +* **samples:** add create range partition table ([#458](https://www.github.com/googleapis/java-bigquery/issues/458)) ([68140d5](https://www.github.com/googleapis/java-bigquery/commit/68140d5e463304253a5cc28e6dae9cc73d1bf8d1)) +* **samples:** add query ([#463](https://www.github.com/googleapis/java-bigquery/issues/463)) ([e5db01c](https://www.github.com/googleapis/java-bigquery/commit/e5db01cac9309d0d2da819276d69af017c367929)) + + +### Dependencies + +* update dependency com.google.apis:google-api-services-bigquery to v2-rev20200603-1.30.9 ([#447](https://www.github.com/googleapis/java-bigquery/issues/447)) ([f53559e](https://www.github.com/googleapis/java-bigquery/commit/f53559e376ff8ebcca7440b977c02feb9b52a64b)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.1 ([#448](https://www.github.com/googleapis/java-bigquery/issues/448)) ([8af668e](https://www.github.com/googleapis/java-bigquery/commit/8af668e2b5e9028cabe70740ea1baa624d35b7c0)) +* update dependency com.google.cloud:google-cloud-storage to v1.109.1 ([#453](https://www.github.com/googleapis/java-bigquery/issues/453)) ([01dd6be](https://www.github.com/googleapis/java-bigquery/commit/01dd6be4f8894d11124f6e68545aa3b3b3ee14d8)) + ### [1.116.2](https://www.github.com/googleapis/java-bigquery/compare/v1.116.1...v1.116.2) (2020-06-09) diff --git a/README.md b/README.md index 75cb6c14c..bfda3f713 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,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.116.2' +compile 'com.google.cloud:google-cloud-bigquery:1.116.3' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "1.116.2" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "1.116.3" ``` [//]: # ({x-version-update-end}) diff --git a/google-cloud-bigquery/pom.xml b/google-cloud-bigquery/pom.xml index 96fbb4195..5cfa2f31f 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.116.3-SNAPSHOT + 1.116.3 jar BigQuery https://github.com/googleapis/java-bigquery @@ -11,7 +11,7 @@ com.google.cloud google-cloud-bigquery-parent - 1.116.3-SNAPSHOT + 1.116.3 google-cloud-bigquery diff --git a/pom.xml b/pom.xml index a484ce5a2..99f7cbee0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-bigquery-parent pom - 1.116.3-SNAPSHOT + 1.116.3 BigQuery Parent https://github.com/googleapis/java-bigquery @@ -86,7 +86,7 @@ com.google.cloud google-cloud-bigquery - 1.116.3-SNAPSHOT + 1.116.3 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 82f81b554..7740b35fb 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-bigquery - 1.116.3-SNAPSHOT + 1.116.3 diff --git a/versions.txt b/versions.txt index d3268fe4d..01f498b82 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-bigquery:1.116.2:1.116.3-SNAPSHOT \ No newline at end of file +google-cloud-bigquery:1.116.3:1.116.3 \ No newline at end of file