Skip to content

Commit

Permalink
Destination BigQuery: add row ids for dummy inserts in check (#34021)
Browse files Browse the repository at this point in the history
Signed-off-by: Gireesh Sreepathi <gisripa@gmail.com>
  • Loading branch information
gisripa authored Jan 8, 2024
1 parent c284588 commit 0e4ffb5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data:
connectorSubtype: database
connectorType: destination
definitionId: 22f6c74f-5699-40ff-833c-4a879ea40133
dockerImageTag: 2.3.27
dockerImageTag: 2.3.28
dockerRepository: airbyte/destination-bigquery
documentationUrl: https://docs.airbyte.com/integrations/destinations/bigquery
githubIssueLabel: destination-bigquery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.cloud.bigquery.Field;
import com.google.cloud.bigquery.FieldList;
import com.google.cloud.bigquery.InsertAllRequest;
import com.google.cloud.bigquery.InsertAllRequest.RowToInsert;
import com.google.cloud.bigquery.InsertAllResponse;
import com.google.cloud.bigquery.Job;
import com.google.cloud.bigquery.JobId;
Expand Down Expand Up @@ -159,13 +160,15 @@ private static void attemptCreateTableAndTestInsert(final BigQuery bigquery, fin
CHECK_TEST_TMP_TABLE_NAME, testTableSchema);

// Try to make test (dummy records) insert to make sure that user has required permissions
// Use ids for BigQuery client to attempt idempotent retries.
// See https://github.com/airbytehq/airbyte/issues/33982
try {
final InsertAllResponse response =
bigquery.insertAll(InsertAllRequest
.newBuilder(test_connection_table_name)
.addRow(Map.of("id", 1, "name", "James"))
.addRow(Map.of("id", 2, "name", "Eugene"))
.addRow(Map.of("id", 3, "name", "Angelina"))
.addRow(RowToInsert.of("1", ImmutableMap.of("id", 1, "name", "James")))
.addRow(RowToInsert.of("2", ImmutableMap.of("id", 2, "name", "Eugene")))
.addRow(RowToInsert.of("3", ImmutableMap.of("id", 3, "name", "Angelina")))
.build());

if (response.hasErrors()) {
Expand All @@ -175,6 +178,7 @@ private static void attemptCreateTableAndTestInsert(final BigQuery bigquery, fin
}
}
} catch (final BigQueryException e) {
LOGGER.error("Dummy inserts in check failed", e);
throw new ConfigErrorException("Failed to check connection: \n" + e.getMessage());
} finally {
test_connection_table_name.delete();
Expand Down
3 changes: 2 additions & 1 deletion docs/integrations/destinations/bigquery.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Now that you have set up the BigQuery destination connector, check out the follo

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:-----------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 2.3.28 | 2024-01-08 | [34021](https://github.com/airbytehq/airbyte/pull/34021) | Add idempotency ids in dummy insert for check call |
| 2.3.27 | 2024-01-05 | [\#33948](https://github.com/airbytehq/airbyte/pull/33948) | Skip retrieving initial table state when setup fails |
| 2.3.26 | 2024-01-04 | [\#33730](https://github.com/airbytehq/airbyte/pull/33730) | Internal code structure changes |
| 2.3.25 | 2023-12-20 | [\#33704](https://github.com/airbytehq/airbyte/pull/33704) | Update to java CDK 0.10.0 (no changes) |
Expand Down Expand Up @@ -301,4 +302,4 @@ Now that you have set up the BigQuery destination connector, check out the follo
| 0.3.10 | 2021-07-28 | [\#3549](https://github.com/airbytehq/airbyte/issues/3549) | Add extended logs and made JobId filled with region and projectId |
| 0.3.9 | 2021-07-28 | [\#5026](https://github.com/airbytehq/airbyte/pull/5026) | Add sanitized json fields in raw tables to handle quotes in column names |
| 0.3.6 | 2021-06-18 | [\#3947](https://github.com/airbytehq/airbyte/issues/3947) | Service account credentials are now optional. |
| 0.3.4 | 2021-06-07 | [\#3277](https://github.com/airbytehq/airbyte/issues/3277) | Add dataset location option |
| 0.3.4 | 2021-06-07 | [\#3277](https://github.com/airbytehq/airbyte/issues/3277) | Add dataset location option |

0 comments on commit 0e4ffb5

Please sign in to comment.