diff --git a/examples/ideas-board/test_semantic_it.py b/examples/ideas-board/test_semantic_it.py index e3116be..1090e43 100644 --- a/examples/ideas-board/test_semantic_it.py +++ b/examples/ideas-board/test_semantic_it.py @@ -2,9 +2,9 @@ The native ``VECTOR`` type requires v25.2+; ``ensure_table()`` also issues ``CREATE VECTOR INDEX`` (v26.2+). Boots the image named by ``CRDB_VECTOR_IMAGE`` -(default ``cockroachdb/cockroach:latest-v25.2``). Skips cleanly when Docker is +(default ``cockroachdb/cockroach:latest-v26.2``). Skips cleanly when Docker is unavailable, and skips honestly (rather than faking a pass) if the chosen image -lacks VECTOR support. Mirrors the Java ``SemanticSearchIT``. +lacks VECTOR/vector-index support. Mirrors the Java ``SemanticSearchIT``. """ from __future__ import annotations @@ -17,7 +17,7 @@ from cockroachdb.ai import Document -IMAGE = os.environ.get("CRDB_VECTOR_IMAGE", "cockroachdb/cockroach:latest-v25.2") +IMAGE = os.environ.get("CRDB_VECTOR_IMAGE", "cockroachdb/cockroach:latest-v26.2") # Four deterministic 3-dim vectors pointing in distinct directions. DOCS = { @@ -44,8 +44,11 @@ def dsn() -> str: def _skip_if_no_vector(exc: Exception) -> None: - if "vector" in str(exc).lower(): - pytest.skip(f"VECTOR unsupported on {IMAGE}: {exc}") + msg = str(exc).lower() + # VECTOR type / CREATE VECTOR INDEX absent on this image surfaces as a + # message mentioning "vector", or a generic "unimplemented" feature error. + if "vector" in msg or "unimplemented" in msg: + pytest.skip(f"VECTOR/vector-index unsupported on {IMAGE}: {exc}") raise exc diff --git a/packages/cockroachdb-ai/pyproject.toml b/packages/cockroachdb-ai/pyproject.toml index ef4a935..929942c 100644 --- a/packages/cockroachdb-ai/pyproject.toml +++ b/packages/cockroachdb-ai/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "cockroachdb-ai" -version = "0.1.1" +version = "0.1.2" description = "CockroachDB AI — vector search, RAG pipelines, and embedding providers for pgvector" readme = "README.md" requires-python = ">=3.11" diff --git a/packages/cockroachdb-ai/src/cockroachdb/ai/vector_store.py b/packages/cockroachdb-ai/src/cockroachdb/ai/vector_store.py index b20df85..c8c949d 100644 --- a/packages/cockroachdb-ai/src/cockroachdb/ai/vector_store.py +++ b/packages/cockroachdb-ai/src/cockroachdb/ai/vector_store.py @@ -274,10 +274,14 @@ def ensure_table(self) -> None: the session-level ``vector_search_beam_size``. """ dimensions = self._config.embedding_dimensions - with psycopg.connect(self._conninfo) as conn: - # Enable vector index feature (required for CREATE VECTOR INDEX) + + # SET CLUSTER SETTING cannot run inside a multi-statement transaction, + # so enable the vector-index feature on its own autocommit connection + # before the CREATE TABLE / CREATE VECTOR INDEX transaction below. + with psycopg.connect(self._conninfo, autocommit=True) as conn: conn.execute("SET CLUSTER SETTING feature.vector_index.enabled = true") + with psycopg.connect(self._conninfo) as conn: conn.execute( f""" CREATE TABLE IF NOT EXISTS {self._table} (