Repository navigation
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 and corresponding unit tests to query and inspect BigQuery vector index build status using INFORMATION_SCHEMA.VECTOR_INDEXES. The feedback suggests three improvements: updating the test configuration in noxfile_config.py to only test the oldest and newest supported Python versions (3.10 and 3.13), printing the retrieved coverage_percentage in the script's output, and updating the unit tests to assert that this coverage percentage is correctly displayed.
|
|
||
| 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, test configurations should only test the oldest and newest supported Python releases, ignoring intermediate versions. Since Python 3.10 is the oldest supported version and Python 3.13 is the newest, we should test 3.10 and 3.13, and ignore 3.11 and 3.12.
| "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.
| index_name = rows[0].index_name if rows else "NONE" | ||
| index_status = rows[0].index_status if rows else "NONE" | ||
| print(f"Resource ID: {table_ref}") | ||
| print(f"Index Count: {len(rows)}") | ||
| print(f"Index Name: {index_name}") | ||
| print(f"Index Status: {index_status}") | ||
| print(f"Job ID: {query_job.job_id}") |
There was a problem hiding this comment.
The SQL query retrieves coverage_percentage from INFORMATION_SCHEMA.VECTOR_INDEXES, and the PR description mentions inspecting the coverage percentage. However, this value is currently not printed or exposed in the output. Let's print the coverage percentage as well.
index_name = rows[0].index_name if rows else "NONE"
index_status = rows[0].index_status if rows else "NONE"
coverage_percentage = rows[0].coverage_percentage if rows else 0
print(f"Resource ID: {table_ref}")
print(f"Index Count: {len(rows)}")
print(f"Index Name: {index_name}")
print(f"Index Status: {index_status}")
print(f"Coverage Percentage: {coverage_percentage}")
print(f"Job ID: {query_job.job_id}"| captured = capsys.readouterr() | ||
| assert ( | ||
| "Resource ID: example-project.example_dataset.example_embeddings" | ||
| in captured.out | ||
| ) | ||
| assert "Index Count: 1" in captured.out | ||
| assert "Index Name: example_vector_index" in captured.out | ||
| assert "Index Status: ACTIVE" in captured.out |
There was a problem hiding this comment.
Update the test assertions to verify that the coverage percentage is correctly printed in the output.
| captured = capsys.readouterr() | |
| assert ( | |
| "Resource ID: example-project.example_dataset.example_embeddings" | |
| in captured.out | |
| ) | |
| assert "Index Count: 1" in captured.out | |
| assert "Index Name: example_vector_index" in captured.out | |
| assert "Index Status: ACTIVE" in captured.out | |
| captured = capsys.readouterr() | |
| assert ( | |
| "Resource ID: example-project.example_dataset.example_embeddings" | |
| in captured.out | |
| ) | |
| assert "Index Count: 1" in captured.out | |
| assert "Index Name: example_vector_index" in captured.out | |
| assert "Index Status: ACTIVE" in captured.out | |
| assert "Coverage Percentage: 100" in captured.out |
e36185f to
b86a97c
Compare
…vector index status and coverage Problem: The BigQuery documentation (https://cloud.google.com/bigquery/docs/vector-index) needs a standalone, tested Python code sample demonstrating how to check vector index status and coverage (region tag `bigquery_get_vector_index_status`). Solution: - Add `get_vector_index_status(project_id: str, dataset_id: str, table_id: str) -> None` in `bigquery/vector_search/bigquery_get_vector_index_status.py` (Query INFORMATION_SCHEMA.VECTOR_INDEXES to inspect vector index status, coverage percentage, and last refresh time.) - Add unit tests (`bigquery/vector_search/bigquery_get_vector_index_status_test.py`) covering both the success path and API error handling (`GoogleAPICallError`)
b86a97c to
a216ed1
Compare
…vector index status and coverage
Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/vector-index) needs a standalone, tested Python code sample demonstrating how to check vector index status and coverage (region tag
bigquery_get_vector_index_status).Solution:
get_vector_index_status(project_id: str, dataset_id: str, table_id: str) -> Noneinbigquery/vector_search/bigquery_get_vector_index_status.py(Query INFORMATION_SCHEMA.VECTOR_INDEXES to inspect vector index status, coverage percentage, and last refresh time.)bigquery/vector_search/bigquery_get_vector_index_status_test.py) covering both the success path and API error handling (GoogleAPICallError)Description
Fixes #
Checklist
Testing
Compliance & Style
Post-Approval Actions