Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Destination Bigquery - ensure raw dataset created with migration #29522

Merged
merged 4 commits into from Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -47,7 +47,7 @@ ENV AIRBYTE_NORMALIZATION_INTEGRATION bigquery

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=1.7.8
LABEL io.airbyte.version=1.7.9
LABEL io.airbyte.name=airbyte/destination-bigquery

ENV AIRBYTE_ENTRYPOINT "/airbyte/run_with_normalization.sh"
Expand Down
Expand Up @@ -2,7 +2,7 @@ data:
connectorSubtype: database
connectorType: destination
definitionId: 22f6c74f-5699-40ff-833c-4a879ea40133
dockerImageTag: 1.7.8
dockerImageTag: 1.7.9
dockerRepository: airbyte/destination-bigquery
githubIssueLabel: destination-bigquery
icon: bigquery.svg
Expand Down
Expand Up @@ -604,11 +604,16 @@ private String wrapAndQuote(final String namespace, final String tableName) {
@Override
public String migrateFromV1toV2(final StreamId streamId, final String namespace, final String tableName) {
return new StringSubstitutor(Map.of(
"raw_namespace", StringUtils.wrap(streamId.rawNamespace(), QUOTE),
"dataset_location", datasetLocation,
"v2_raw_table", streamId.rawTableId(QUOTE),
"v1_raw_table", wrapAndQuote(namespace, tableName)
)
).replace(
"""
"""
CREATE SCHEMA IF NOT EXISTS ${raw_namespace}
OPTIONS(location="${dataset_location}");
Comment on lines +614 to +615
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


CREATE OR REPLACE TABLE ${v2_raw_table} (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this table create statement also need OPTIONS(location="${dataset_location}"), or will being within the schema take care of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fairly confident that bigquery doesn't let you create tables in a different location than the dataset

_airbyte_raw_id STRING,
_airbyte_data JSON,
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/destinations/bigquery.md
Expand Up @@ -135,6 +135,7 @@ Now that you have set up the BigQuery destination connector, check out the follo

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:-----------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------|
| 1.7.8 | 2023-08-17 | [\#29522](https://github.com/airbytehq/airbyte/pull/29522) | Migration BugFix - ensure raw dataset created |
| 1.7.8 | 2023-08-15 | [\#29461](https://github.com/airbytehq/airbyte/pull/29461) | Migration BugFix - ensure migration happens before table creation for GCS staging. |
| 1.7.7 | 2023-08-11 | [\#29381](https://github.com/airbytehq/airbyte/pull/29381) | Destinations v2: Add support for streams with no columns |
| 1.7.6 | 2023-08-04 | [\#28894](https://github.com/airbytehq/airbyte/pull/28894) | Destinations v2: Add v1 -> v2 migration Logic |
Expand Down