Repository navigation
feat(bigquery): add bigquery_search_exclude_columns sample to search … - #14733
Conversation
|
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new BigQuery search sample demonstrating how to search a table while excluding specific columns using SELECT AS STRUCT ... EXCEPT, along with its corresponding unit tests and configuration files. The feedback suggests updating the ignored Python versions in noxfile_config.py to align with the repository's testing guidelines of only testing the oldest and newest supported releases. Additionally, the unit tests should be improved by mocking the NotFound exception on query_job.result() rather than client.query() to more accurately simulate the asynchronous behavior of the BigQuery client.
014b46c to
68475db
Compare
XrossFox
left a comment
There was a problem hiding this comment.
So, i was taking a look at the comment by gemini, and i think it's correct: calling client.query() initially, doesn't return an exception right away, because it's an asynchronous method, that means the exception will be stored in the QueryObject.exception if it fails. According to the docs on QueryObject, calling QueryJob.result() blocks current execution and awaits for the operation to finish, then, if an exeption is encountered, the exception is raised, so a more accurate mock of exception handling would be to add the exception to the result of result().
…a table while excluding specific columns Problem: The BigQuery documentation (https://cloud.google.com/bigquery/docs/search) needs a standalone, tested Python code sample demonstrating how to search a table while excluding specific columns (region tag `bigquery_search_exclude_columns`). Solution: - Add `search_exclude_columns(project_id: str) -> None` in `bigquery/search/bigquery_search_exclude_columns.py` (Search all columns of a BigQuery table except specified excluded columns using SELECT AS STRUCT * EXCEPT(...).) - Add unit tests (`bigquery/search/bigquery_search_exclude_columns_test.py`) covering both the success path and API error handling (`GoogleAPICallError`)
68475db to
1352f46
Compare
…a table while excluding specific columns
Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/search) needs a standalone, tested Python code sample demonstrating how to search a table while excluding specific columns (region tag
bigquery_search_exclude_columns).Solution:
search_exclude_columns(project_id: str) -> Noneinbigquery/search/bigquery_search_exclude_columns.py(Search all columns of a BigQuery table except specified excluded columns using SELECT AS STRUCT * EXCEPT(...).)bigquery/search/bigquery_search_exclude_columns_test.py) covering both the success path and API error handling (GoogleAPICallError)Description
Fixes #
Checklist
Testing
Compliance & Style
Post-Approval Actions