Skip to content

feat(bigquery): add bigquery_create_vector_index sample to create an … - #14751

Open
iennae wants to merge 1 commit into
mainfrom
feat/bq-create-vector-index
Open

iennae wants to merge 1 commit into
mainfrom
feat/bq-create-vector-index

Conversation

@iennae

@iennae iennae commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

…IVF 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 an IVF vector index on embedding column (region tag bigquery_create_vector_index).

Solution:

  • Add create_vector_index(project_id: str, dataset_id: str, table_id: str) -> None in bigquery/vector_search/bigquery_create_vector_index.py (Create an inverted file (IVF) vector index on an array embedding column in BigQuery using CREATE VECTOR INDEX.)
  • Add unit tests (bigquery/vector_search/bigquery_create_vector_index_test.py) covering both the success path and API error handling (GoogleAPICallError)

Description

Fixes #

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 2, 2026 23:31
@snippet-bot

snippet-bot Bot commented Nov 2, 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 2, 2026
@iennae
iennae force-pushed the feat/bq-create-vector-index branch from 5541db0 to a823efe Compare November 2, 2026 23:33

@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 unit tests for creating an IVF vector index on a BigQuery table. It also adds the necessary configuration and dependency files for testing. The feedback suggests updating the noxfile_config.py to remove Python 3.10 from the ignored versions list, ensuring that the oldest supported Python version is properly tested in accordance with repository guidelines.


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"],

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.

medium

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 requirements-test.txt specifies python_version >= "3.10", Python 3.10 is the oldest supported version and should be tested. Please remove "3.10" from ignored_versions.

Suggested change
"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"],
References
  1. Only test the oldest and newest supported Python releases in test configurations (such as noxfile_config.py), ignoring intermediate versions.

@iennae
iennae force-pushed the feat/bq-create-vector-index branch from a823efe to e6cf67c Compare November 3, 2026 02:44
…IVF 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 an IVF vector index on embedding column (region tag `bigquery_create_vector_index`).

Solution:
- Add `create_vector_index(project_id: str, dataset_id: str, table_id: str) -> None` in `bigquery/vector_search/bigquery_create_vector_index.py`
  (Create an inverted file (IVF) vector index on an array embedding column in BigQuery using CREATE OR REPLACE VECTOR INDEX.)
- Add unit tests (`bigquery/vector_search/bigquery_create_vector_index_test.py`) covering both the success
  path and API error handling (`GoogleAPICallError`)
@iennae
iennae force-pushed the feat/bq-create-vector-index branch from e6cf67c to 01efd05 Compare November 3, 2026 23:32

@amcolin amcolin 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

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