Repository navigation
feat(bigquery): add bigquery_query_biglake_gcs_temp_table sample to q… - #14752
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 Python sample for configuring and querying a temporary BigLake table backed by Cloud Storage, along with its corresponding unit tests and configuration files. The feedback recommends updating the ignored_versions in noxfile_config.py to ensure that only the oldest and newest supported Python versions are tested, which means Python 3.10 should not be ignored.
|
|
||
| TEST_CONFIG_OVERRIDE = { | ||
| # You can opt out from the test for specific Python versions. | ||
| "ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"], |
There was a problem hiding this comment.
According to the repository's general rules, we should only test the oldest and newest supported Python releases in test configurations (such as noxfile_config.py), ignoring intermediate versions. Since Python 3.10 is the oldest supported version (as indicated by requirements-test.txt), it should not be ignored. Assuming Python 3.13 is the newest supported version, we should ignore intermediate versions like 3.11 and 3.12 instead.
| "ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"], | |
| "ignored_versions": ["2.7", "3.7", "3.8", "3.9", "3.11", "3.12"], |
References
- Only test the oldest and newest supported Python releases in test configurations (such as noxfile_config.py), ignoring intermediate versions.
442f921 to
16d3640
Compare
…uery a temporary BigLake table on Cloud Storage Problem: The BigQuery documentation (https://cloud.google.com/bigquery/docs/query-cloud-storage-using-biglake) needs a standalone, tested Python code sample demonstrating how to query a temporary BigLake table on Cloud Storage (region tag `bigquery_query_biglake_gcs_temp_table`). Solution: - Add `query_biglake_gcs_temp_table(project_id: str, connection_id: str) -> None` in `bigquery/biglake/bigquery_query_biglake_gcs_temp_table.py` (Configure an ephemeral BigLake table definition over Cloud Storage files using ExternalConfig and query it within a single job.) - Add unit tests (`bigquery/biglake/bigquery_query_biglake_gcs_temp_table_test.py`) covering both the success path and API error handling (`GoogleAPICallError`)
16d3640 to
2e76dcc
Compare
…gcs_temp_table tests Problem: The tests replaced the client class with `lambda project=None: mock_client`. A lambda only accepts that one keyword, so the test would break for reasons unrelated to the sample if the constructor call changed, and it records nothing, so the tests could not verify how the client was created. Solution: Patch the client class with `mock.MagicMock(return_value=mock_client)` and assert in the success test that the sample constructed it exactly once with the expected arguments.
…uery a temporary BigLake table on Cloud Storage
Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/query-cloud-storage-using-biglake) needs a standalone, tested Python code sample demonstrating how to query a temporary BigLake table on Cloud Storage (region tag
bigquery_query_biglake_gcs_temp_table).Solution:
query_biglake_gcs_temp_table(project_id: str, connection_id: str) -> Noneinbigquery/biglake/bigquery_query_biglake_gcs_temp_table.py(Configure an ephemeral BigLake table definition over Cloud Storage files using ExternalConfig and query it within a single job.)bigquery/biglake/bigquery_query_biglake_gcs_temp_table_test.py) covering both the success path and API error handling (GoogleAPICallError)Description
Fixes #
Checklist
Testing
Compliance & Style
Post-Approval Actions