Skip to content

feat(bigquery): add bigquery_create_vector_index_tree_ah sample to cr… - #14719

Merged
iennae merged 1 commit into
mainfrom
feat/bq-create-vector-index-tree-ah
Nov 3, 2026
Merged

iennae merged 1 commit into
mainfrom
feat/bq-create-vector-index-tree-ah

Conversation

@iennae

@iennae iennae commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

…eate a TreeAH vector index on embedding column

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/vector-index) needs a standalone, tested Python code sample demonstrating how to create a TreeAH vector index on embedding column (region tag bigquery_create_vector_index_tree_ah).

Solution:

  • Add create_vector_index_tree_ah(project_id: str, dataset_id: str, table_id: str) -> None in bigquery/vector_search/bigquery_create_vector_index_tree_ah.py (Create a ScaNN-based TREE_AH vector index on an embedding column in BigQuery using CREATE OR REPLACE VECTOR INDEX.)
  • Add unit tests (bigquery/vector_search/bigquery_create_vector_index_tree_ah_test.py) covering both the success path and API error handling (GoogleAPICallError)

Checklist

Testing

  • I have tested this change on a live environment and verified it works as intended.

Compliance & Style


Post-Approval Actions

  • Please merge this PR for me once it is approved

@iennae
iennae requested review from a team and chalmerlowe as code owners November 1, 2026 20:23
@snippet-bot

snippet-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label Bot added api: bigquery Issues related to the BigQuery API. samples Issues that are directly related to samples. labels Nov 1, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Python sample script and corresponding unit tests for creating a TreeAH vector index on a BigQuery table, along with test configuration and requirements files. The review feedback highlights two main improvements: removing an unreachable exceptions.AlreadyExists exception handler in the index creation script since CREATE OR REPLACE is used, and adjusting the ignored Python versions in noxfile_config.py to ensure the oldest supported version (Python 3.10) is properly tested while intermediate versions are ignored.

@XrossFox XrossFox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, there is an outdated dependency.

Comment thread bigquery/vector_search/requirements.txt Resolved
@iennae
iennae force-pushed the feat/bq-create-vector-index-tree-ah branch 3 times, most recently from 5fed9d8 to 80711d3 Compare November 2, 2026 23:33
…eate a TreeAH vector index on embedding column

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/vector-index)
needs a standalone, tested Python code sample demonstrating how to
create a TreeAH vector index on embedding column (region tag `bigquery_create_vector_index_tree_ah`).

Solution:
- Add `create_vector_index_tree_ah(project_id: str, dataset_id: str, table_id: str) -> None` in `bigquery/vector_search/bigquery_create_vector_index_tree_ah.py`
  (Create a ScaNN-based TREE_AH vector index on an embedding column in BigQuery using CREATE OR REPLACE VECTOR INDEX.)
- Add unit tests (`bigquery/vector_search/bigquery_create_vector_index_tree_ah_test.py`) covering both the success
  path and API error handling (`GoogleAPICallError`)
@iennae
iennae force-pushed the feat/bq-create-vector-index-tree-ah branch from 80711d3 to f338759 Compare November 3, 2026 02:44
@iennae
iennae merged commit 38ee64e into main Nov 3, 2026
14 of 22 checks passed
@iennae
iennae deleted the feat/bq-create-vector-index-tree-ah branch November 3, 2026 02:51
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 BigQuery API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants