Repository navigation
fix(ai): run SET CLUSTER SETTING outside ensure_table transaction; release 0.1.2 - #7
Merged
Merged
Conversation
ensure_table() issued `SET CLUSTER SETTING feature.vector_index.enabled` on the same connection as CREATE TABLE / CREATE VECTOR INDEX. psycopg3 wraps those statements in one transaction, and CockroachDB rejects `SET CLUSTER SETTING cannot be used inside a multi-statement transaction`, so ensure_table() failed before the table was ever created. Enable the feature on its own autocommit connection first, then run the table + index DDL in the normal transaction. Behaviour is otherwise unchanged; the mocked vector_store tests still pass. Also make the semantic example IT deterministic: default CRDB_VECTOR_IMAGE to a vector-index-capable image (latest-v26.2) so CREATE VECTOR INDEX actually runs, and broaden the skip guard to also treat "unimplemented" feature errors as a graceful skip. Bump cockroachdb-ai to 0.1.2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CockroachDBVectorStore.ensure_table()ranSET CLUSTER SETTING feature.vector_index.enabled = trueon the same psycopg3 connection asCREATE TABLE/CREATE VECTOR INDEX. Those run in one implicit transaction, and CockroachDB rejectsSET CLUSTER SETTING cannot be used inside a multi-statement transaction— soensure_table()failed. Caught by the Ideas Board semantic integration test.Fix
autocommit=Trueconnection, then run the table + index DDL in the normal transaction. No other behaviour changes; the mockedtests/test_ai_vector_store.pysuite (21 tests) still passes.CRDB_VECTOR_IMAGEtocockroachdb/cockroach:latest-v26.2(CREATE VECTOR INDEX is v26.2+), and broaden the skip guard to treatunimplementedfeature errors as a graceful skip.cockroachdb-ai0.1.1 -> 0.1.2 (publishes via the PEP 503 Pages feed on merge to main).Validation
Repo CI (ruff format/check, mypy, pytest). The published 0.1.2 is then validated end-to-end by the example-IT workflow (PR #6).