KEMBAR78
feat: Adds source_column_match and associated tests by chalmerlowe · Pull Request #2227 · googleapis/python-bigquery · GitHub
Skip to content

Conversation

@chalmerlowe
Copy link
Collaborator

This commit introduces new configuration options for BigQuery load jobs and external table definitions, aligning with recent updates to the underlying protos.

New options added:

  • source_column_name_match_option: Controls how source columns are matched to the schema. (Applies to LoadJobConfig, ExternalConfig, LoadJob)

Changes include:

  • Added corresponding properties (getters/setters) to LoadJobConfig, LoadJob, ExternalConfig, and CSVOptions.
  • Updated docstrings and type hints for all new attributes.
  • Updated unit tests to cover the new options, ensuring they are correctly handled during object initialization, serialization to API representation, and deserialization from API responses.

@chalmerlowe chalmerlowe requested review from a team as code owners July 2, 2025 16:22
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery API. labels Jul 2, 2025
@chalmerlowe chalmerlowe assigned Linchin and unassigned yirutang Jul 2, 2025
@chalmerlowe chalmerlowe requested review from Linchin and removed request for agrawal-siddharth July 2, 2025 16:23
@chalmerlowe chalmerlowe self-assigned this Jul 2, 2025
Copy link
Collaborator Author

@chalmerlowe chalmerlowe left a comment

Choose a reason for hiding this comment

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

Altered docstring formatting to try and eliminate a docs error.

@chalmerlowe chalmerlowe added the automerge Merge the pull request once unit tests and other checks pass. label Jul 15, 2025
# return None

@source_column_match.setter
def source_column_match(self, value: Optional[SourceColumnMatch]):
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like us to allow str in the setter as well. Can you update this, please?

return None

@source_column_match.setter
def source_column_match(self, value: Optional[SourceColumnMatch]):
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. Can we allow str, please?

return self.configuration.clustering_fields

@property
def source_column_match(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing return type annotation?

config._properties["load"]["sourceColumnMatch"] = option_enum.value
self.assertEqual(config.source_column_match, option_enum)

def test_source_column_match_setter(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add another test where we use the setter with a str, too?

Copy link
Collaborator Author

@chalmerlowe chalmerlowe Jul 15, 2025

Choose a reason for hiding this comment

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

Done, both here and in test_external_config.py

Copy link
Contributor

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Thanks!

@gcf-merge-on-green gcf-merge-on-green bot merged commit 6d5d236 into main Jul 15, 2025
28 checks passed
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Jul 15, 2025
@gcf-merge-on-green gcf-merge-on-green bot deleted the feat-374142081-add-source-column-match branch July 15, 2025 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants