-
Notifications
You must be signed in to change notification settings - Fork 322
feat: Adds source_column_match and associated tests #2227
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
Merged
gcf-merge-on-green
merged 14 commits into
main
from
feat-374142081-add-source-column-match
Jul 15, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fc3dbf7
Adds source_column_match and associated tests
chalmerlowe 88c3775
Update google/cloud/bigquery/job/load.py
chalmerlowe 9403046
Update google/cloud/bigquery/external_config.py
chalmerlowe b6261dc
Update google/cloud/bigquery/job/load.py
chalmerlowe 964b1d0
Update google/cloud/bigquery/external_config.py
chalmerlowe c25727d
updates docstring to account for sphinx unexpected indent warning
chalmerlowe 3b39fc3
Merge branch 'main' into feat-374142081-add-source-column-match
chalmerlowe 5686794
Merge branch 'main' into feat-374142081-add-source-column-match
chalmerlowe c31b1ad
Merge branch 'main' into feat-374142081-add-source-column-match
chalmerlowe b7eabe1
Updates docstrings and tests
chalmerlowe 3b10ee1
Merge branch 'main' into feat-374142081-add-source-column-match
chalmerlowe a1eddb5
Update google/cloud/bigquery/external_config.py
chalmerlowe 4ac00ca
updates allowed arg types to include str, and assoc. tests
chalmerlowe 8351a1c
Updates a test to accommodate for strings.
chalmerlowe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -844,6 +844,38 @@ def test_write_disposition_setter(self): | |
| config._properties["load"]["writeDisposition"], write_disposition | ||
| ) | ||
|
|
||
| def test_source_column_match_missing(self): | ||
| config = self._get_target_class()() | ||
| self.assertIsNone(config.source_column_match) | ||
|
|
||
| def test_source_column_match_hit(self): | ||
| from google.cloud.bigquery.enums import SourceColumnMatch | ||
|
|
||
| option_enum = SourceColumnMatch.NAME | ||
| config = self._get_target_class()() | ||
| # Assume API stores the string value of the enum | ||
| config._properties["load"]["sourceColumnMatch"] = option_enum.value | ||
| self.assertEqual(config.source_column_match, option_enum) | ||
|
|
||
| def test_source_column_match_setter(self): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we add another test where we use the setter with a
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, both here and in test_external_config.py |
||
| from google.cloud.bigquery.enums import SourceColumnMatch | ||
|
|
||
| option_enum = SourceColumnMatch.POSITION | ||
| config = self._get_target_class()() | ||
| config.source_column_match = option_enum | ||
| # Assert that the string value of the enum is stored | ||
| self.assertEqual( | ||
| config._properties["load"]["sourceColumnMatch"], option_enum.value | ||
| ) | ||
| option_str = "NAME" | ||
| config.source_column_match = option_str | ||
| self.assertEqual(config._properties["load"]["sourceColumnMatch"], option_str) | ||
|
|
||
| def test_source_column_match_setter_invalid_type(self): | ||
| config = self._get_target_class()() | ||
| with self.assertRaises(TypeError): | ||
| config.source_column_match = 3.14 | ||
|
|
||
| def test_date_format_missing(self): | ||
| config = self._get_target_class()() | ||
| self.assertIsNone(config.date_format) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.