Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

refactor: Refactors load_table_* methods to reduce code duplication#2267

Closed
chalmerlowe wants to merge 2 commits intomainfrom
refactor-load-table-methods
Closed

refactor: Refactors load_table_* methods to reduce code duplication#2267
chalmerlowe wants to merge 2 commits intomainfrom
refactor-load-table-methods

Conversation

@chalmerlowe
Copy link
Copy Markdown
Collaborator

This commit refactors the load_table_from_uri, load_table_from_file, load_table_from_dataframe, and load_table_from_json methods in the BigQuery client.

A new private helper method, _prepare_load_job, has been introduced to centralize the creation and configuration of LoadJob objects. This eliminates redundant code for setting up job IDs, projects, and locations.

A second helper, _prepare_load_config, was also added to standardize the handling of LoadJobConfig objects, merging user-provided configurations with client defaults.

These changes make the loading methods more concise, easier to read, and simpler to maintain.

This commit refactors the `load_table_from_uri`, `load_table_from_file`,
`load_table_from_dataframe`, and `load_table_from_json` methods in the
BigQuery client.

A new private helper method, `_prepare_load_job`, has been introduced to
centralize the creation and configuration of `LoadJob` objects. This
eliminates redundant code for setting up job IDs, projects, and locations.

A second helper, `_prepare_load_config`, was also added to standardize
the handling of `LoadJobConfig` objects, merging user-provided
configurations with client defaults.

These changes make the loading methods more concise, easier to read, and
simpler to maintain.
@chalmerlowe chalmerlowe requested review from a team and logachev August 23, 2025 22:30
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Aug 23, 2025
@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Aug 23, 2025
@chalmerlowe
Copy link
Copy Markdown
Collaborator Author

I might come back to this, but for now, not sure the risks are worth the benefits.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

2 participants