-
Notifications
You must be signed in to change notification settings - Fork 318
feat: Add new options to LoadJobConfig and ExternalConfig #2225
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
Draft
chalmerlowe
wants to merge
14
commits into
main
Choose a base branch
from
feat-new-load-options
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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 commit introduces new configuration options for BigQuery load jobs and external table definitions, aligning with recent updates to the underlying protos. New options added: - `time_zone`: Specifies the default timezone for parsing timestamps. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON) - `date_format`: Specifies the format for parsing DATE values. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON) - `datetime_format`: Specifies the format for parsing DATETIME values. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON) - `time_format`: Specifies the format for parsing TIME values. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON) - `timestamp_format`: Specifies the format for parsing TIMESTAMP values. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON) - `null_markers`: A list of strings to be interpreted as NULL. (Applies to LoadJobConfig, ExternalConfig (via CSVOptions); CSV only) - `source_column_name_match_option`: Controls how source columns are matched to the schema. (Applies to LoadJobConfig, ExternalConfig (via CSVOptions); CSV only) 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.
Adds miss, hit, and setter tests to `tests/unit/job/test_load_config.py` for the following properties of `LoadJobConfig`: - time_zone - date_format - datetime_format - time_format - timestamp_format - null_markers - source_column_name_match_option These tests verify that the properties can be set, retrieved, and correctly interact with the underlying configuration dictionary.
This commit restores user changes from commit a9b187f that were inadvertently overwritten. These changes include: - Addition of SourceColumnMatch enum in enums.py. - Updates to docstrings in external_config.py and job/load.py. - Renaming of source_column_name_match_option to source_column_match_strategy in LoadJobConfig and LoadJob, now using the SourceColumnMatch enum. - Adjustments in related unit tests in test_load.py and test_external_config.py. Additionally, this commit incorporates the new unit tests for all recently added LoadJobConfig properties in tests/unit/job/test_load_config.py. Corrections were made to tests/unit/job/test_load.py to align with the renamed source_column_match_strategy property and its enum type.
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: l
Pull request size is large.
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.
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:
time_zone
: Specifies the default timezone for parsing timestamps. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON)date_format
: Specifies the format for parsing DATE values. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON)datetime_format
: Specifies the format for parsing DATETIME values. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON)time_format
: Specifies the format for parsing TIME values. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON)timestamp_format
: Specifies the format for parsing TIMESTAMP values. (Applies to LoadJobConfig, ExternalConfig; CSV & JSON)null_markers
: A list of strings to be interpreted as NULL. (Applies to LoadJobConfig, ExternalConfig (via CSVOptions); CSV only)source_column_name_match_option
: Controls how source columns are matched to the schema. (Applies to LoadJobConfig, ExternalConfig (via CSVOptions); CSV only)Changes include:
LoadJobConfig
,LoadJob
,ExternalConfig
, andCSVOptions
.