PyOBVector
raw JSON → 0.2.26 verified Mon Apr 27 auth: no python
A Python SDK for OceanBase Vector Store, based on SQLAlchemy, compatible with Milvus API. Version 0.2.26. Active development.
pip install pyobvector Common errors
error ModuleNotFoundError: No module named 'obvector' ↓
cause Trying to import obvector directly instead of pyobvector.obvector
fix
Use 'from pyobvector import obvector' or 'import pyobvector.obvector as obvector'
error pyobvector.exceptions.ConnectionError: cannot connect to OceanBase ↓
cause Missing or incorrect connection parameters; OceanBase not running
fix
Check OB_HOST, OB_PORT, and ensure OceanBase is accessible. Use client.ping() to test.
error AttributeError: 'VecClient' object has no attribute 'insert' ↓
cause Forgot to call client.connect() before using vector operations
fix
Call client.connect() after VecClient initialization.
Warnings
breaking Connection parameters changed between 0.1.x and 0.2.x: removed 'tenant' parameter, added 'database'. ↓
fix Use 'database' parameter instead of 'tenant'. See migration guide.
gotcha VecClient.connect() must be called after initialization for vector operations. ↓
fix Call client.connect() before any vector operation.
deprecated The 'table_name' parameter in VecClient.insert() is deprecated; use 'collection_name' instead. ↓
fix Use 'collection_name' parameter.
Imports
- VecClient wrong
from obvector import VecClientcorrectfrom pyobvector import VecClient - obvector wrong
import obvectorcorrectimport pyobvector.obvector as obvector
Quickstart
from pyobvector import VecClient
import os
client = VecClient(
host=os.environ.get('OB_HOST', 'localhost'),
port=int(os.environ.get('OB_PORT', 2881)),
user=os.environ.get('OB_USER', 'root'),
password=os.environ.get('OB_PASSWORD', ''),
database=os.environ.get('OB_DATABASE', 'test')
)
print(client.ping())