-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Handle embedded project ID in dataset ID during normalization #11077
Conversation
/test connector=bases/base-normalization
|
try: | ||
colon_index = config["dataset_id"].index(":") | ||
except ValueError: | ||
colon_index = None | ||
|
||
if colon_index is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I freely admit that I don't know Python conventions, so sorry in advance if this code looks terrible :P
No worries! We all have to start somewhere
Maybe it'd be simpler to do in one line:
try: | |
colon_index = config["dataset_id"].index(":") | |
except ValueError: | |
colon_index = None | |
if colon_index is not None: | |
if ":" in config["dataset_id"] |
I guess the convention my instincts are trying to follow here is related to this "rule":
https://docs.python-guide.org/writing/style/#access-a-dictionary-element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, you can follow-up with just using the split
string function in python instead of slicing with indices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! added a check for too many colons just in case it gets mistyped (previously I guess we would have thrown an exception when trying to interact with bigquery)
/publish connector=bases/base-normalization
|
What
Followup to #8383 / #1192
That PR added handling in the destination; we also need to handle this in normalization.
How
When transforming the config, check for this case and mangle the dataset ID value if needed. If the values mismatch, then raise an exception (this is the same behavior as the destination; see https://github.com/airbytehq/airbyte/pull/8383/files#diff-4fd5ae109bf5f80f90ed87bce2642adaca412cce321a84632c1208ccf8ea7ce7R173 )
I freely admit that I don't know Python conventions, so sorry in advance if this code looks terrible :P
Recommended reading order
🚨 User Impact 🚨
No
Pre-merge Checklist
Expand the relevant checklist and delete the others.
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereTests
Unit