From 76c4053282489b89e2eb70b45e03feb4212104b9 Mon Sep 17 00:00:00 2001 From: Marcelo Castro Date: Wed, 3 Aug 2022 15:18:34 -0300 Subject: [PATCH] Destination BigQuery: Enabling Application Default Credentials (#14784) * Enabling different bigquery authentications Current implementation only accepts Service Accounts. For developers it is very desirable that we can login with Application Default Credentials (ADC) https://cloud.google.com/sdk/gcloud/reference/auth/application-default * bump version and update doc * auto-bump connector version [ci skip] Co-authored-by: marcosmarxm Co-authored-by: Octavia Squidington III --- .../src/main/resources/seed/destination_definitions.yaml | 2 +- .../init/src/main/resources/seed/destination_specs.yaml | 2 +- .../connectors/destination-bigquery/Dockerfile | 2 +- .../destination/bigquery/BigQueryDestination.java | 5 ++--- docs/integrations/destinations/bigquery.md | 3 ++- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/airbyte-config/init/src/main/resources/seed/destination_definitions.yaml b/airbyte-config/init/src/main/resources/seed/destination_definitions.yaml index b98d53adf255..7f555a780db7 100644 --- a/airbyte-config/init/src/main/resources/seed/destination_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/destination_definitions.yaml @@ -27,7 +27,7 @@ - name: BigQuery destinationDefinitionId: 22f6c74f-5699-40ff-833c-4a879ea40133 dockerRepository: airbyte/destination-bigquery - dockerImageTag: 1.1.13 + dockerImageTag: 1.1.14 documentationUrl: https://docs.airbyte.io/integrations/destinations/bigquery icon: bigquery.svg resourceRequirements: diff --git a/airbyte-config/init/src/main/resources/seed/destination_specs.yaml b/airbyte-config/init/src/main/resources/seed/destination_specs.yaml index 3528b0732770..a6b139d16138 100644 --- a/airbyte-config/init/src/main/resources/seed/destination_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/destination_specs.yaml @@ -285,7 +285,7 @@ supported_destination_sync_modes: - "overwrite" - "append" -- dockerImage: "airbyte/destination-bigquery:1.1.13" +- dockerImage: "airbyte/destination-bigquery:1.1.14" spec: documentationUrl: "https://docs.airbyte.io/integrations/destinations/bigquery" connectionSpecification: diff --git a/airbyte-integrations/connectors/destination-bigquery/Dockerfile b/airbyte-integrations/connectors/destination-bigquery/Dockerfile index ab4f9e91956d..382747ed3d2b 100644 --- a/airbyte-integrations/connectors/destination-bigquery/Dockerfile +++ b/airbyte-integrations/connectors/destination-bigquery/Dockerfile @@ -17,5 +17,5 @@ ENV ENABLE_SENTRY true COPY --from=build /airbyte /airbyte -LABEL io.airbyte.version=1.1.13 +LABEL io.airbyte.version=1.1.14 LABEL io.airbyte.name=airbyte/destination-bigquery diff --git a/airbyte-integrations/connectors/destination-bigquery/src/main/java/io/airbyte/integrations/destination/bigquery/BigQueryDestination.java b/airbyte-integrations/connectors/destination-bigquery/src/main/java/io/airbyte/integrations/destination/bigquery/BigQueryDestination.java index 40061e89f29f..b6ed2eea285b 100644 --- a/airbyte-integrations/connectors/destination-bigquery/src/main/java/io/airbyte/integrations/destination/bigquery/BigQueryDestination.java +++ b/airbyte-integrations/connectors/destination-bigquery/src/main/java/io/airbyte/integrations/destination/bigquery/BigQueryDestination.java @@ -7,7 +7,6 @@ import com.codepoetics.protonpack.StreamUtils; import com.fasterxml.jackson.databind.JsonNode; import com.google.auth.oauth2.GoogleCredentials; -import com.google.auth.oauth2.ServiceAccountCredentials; import com.google.cloud.bigquery.BigQuery; import com.google.cloud.bigquery.BigQueryOptions; import com.google.cloud.bigquery.Job; @@ -176,14 +175,14 @@ private static GoogleCredentials getServiceAccountCredentials(final JsonNode con if (!BigQueryUtils.isUsingJsonCredentials(config)) { LOGGER.info("No service account key json is provided. It is required if you are using Airbyte cloud."); LOGGER.info("Using the default service account credential from environment."); - return ServiceAccountCredentials.getApplicationDefault(); + return GoogleCredentials.getApplicationDefault(); } // The JSON credential can either be a raw JSON object, or a serialized JSON object. final String credentialsString = config.get(BigQueryConsts.CONFIG_CREDS).isObject() ? Jsons.serialize(config.get(BigQueryConsts.CONFIG_CREDS)) : config.get(BigQueryConsts.CONFIG_CREDS).asText(); - return ServiceAccountCredentials.fromStream( + return GoogleCredentials.fromStream( new ByteArrayInputStream(credentialsString.getBytes(Charsets.UTF_8))); } diff --git a/docs/integrations/destinations/bigquery.md b/docs/integrations/destinations/bigquery.md index fea5b503b7db..01ba5b695fd0 100644 --- a/docs/integrations/destinations/bigquery.md +++ b/docs/integrations/destinations/bigquery.md @@ -133,7 +133,8 @@ Now that you have set up the BigQuery destination connector, check out the follo | Version | Date | Pull Request | Subject | |:--------|:-----------|:-----------------------------------------------------------|:------------------------------------------------------------------------------------------------| -| 1.1.13 | 2022-00-02 | [15180](https://github.com/airbytehq/airbyte/pull/15180) | Fix standard loading mode | +| 1.1.14 | 2022-08-03 | [14784](https://github.com/airbytehq/airbyte/pull/14784) | Enabling Application Default Credentials | +| 1.1.13 | 2022-08-02 | [15180](https://github.com/airbytehq/airbyte/pull/15180) | Fix standard loading mode | | 1.1.12 | 2022-08-02 | [14801](https://github.com/airbytehq/airbyte/pull/14801) | Fix multiply log bindings | | 1.1.11 | 2022-06-24 | [14114](https://github.com/airbytehq/airbyte/pull/14114) | Remove "additionalProperties": false from specs for connectors with staging | | 1.1.10 | 2022-06-16 | [13852](https://github.com/airbytehq/airbyte/pull/13852) | Updated stacktrace format for any trace message errors |