VictorDB is a Python client and ORM for high-performance vector and key-value databases. It provides a simple, flexible API for vector search, key-value storage, and object modeling, making it easy to build modern AI and data applications.
Project description
VictorDB Python Client
VictorDB is a Python client and ORM for high-performance vector and key-value databases. It provides a simple, flexible API for vector search, key-value storage, and object modeling, making it easy to build modern AI and data applications.
- Library Core (libvictor): https://github.com/victor-base/libvictor
- Database (victordb): https://github.com/victor-base/victordb
Features
- Vector index operations: insert, search, delete
- Key-value table operations: put, get, delete
- ORM-style data modeling with secondary indexes
- High-performance, binary protocol (CBOR)
- Pluggable and extensible design
Installation
pip install victordb
Quick Start
from victordb.victor import VictorIndexClient, VictorTableClient, VictorSession, VictorBaseModel
# Connect to VictorDB server (vector index)
index_client = VictorIndexClient()
index_client.connect(host="localhost", port=9000)
# Insert a vector
index_client.insert(id=123, vector=[0.1, 0.2, 0.3])
# Search for similar vectors
results = index_client.search(vector=[0.1, 0.2, 0.3], topk=5)
print(results)
# Connect to VictorDB server (key-value table)
table_client = VictorTableClient()
table_client.connect(host="localhost", port=9001)
# Store and retrieve a value
table_client.put(b"mykey", b"myvalue")
value = table_client.get(b"mykey")
print(value)
ORM Example
Define your own models by inheriting from VictorBaseModel:
from victordb.victor import VictorSession, VictorTableClient, VictorBaseModel
from dataclasses import dataclass, field
@dataclass
class User(VictorBaseModel):
__classname__ = "User"
__indexed__ = ["email"]
email: str = ""
name: str = ""
# Connect to table and create session
table = VictorTableClient()
table.connect(host="localhost", port=9001)
session = VictorSession(table)
# Create and save a user
user = User(email="alice@example.com", name="Alice")
user.save(session)
# Query by indexed field
users = User.query_eq(session, "email", "alice@example.com")
print(users)
API Overview
VictorIndexClient
insert(id: int, vector: List[float]) -> intdelete(id: int) -> boolsearch(vector: List[float], topk: int) -> List[Tuple[int, float]]
VictorTableClient
put(key: bytes, value: bytes) -> boolget(key: bytes) -> Optional[bytes]delete(key: bytes) -> boolto_bytes(value: Any) -> bytesfrom_bytes(data: bytes, target_type: str = 'auto') -> Any
VictorSession
new_id() -> intkv_put(key: str, value: Any) -> Nonekv_get(key: str, target_type='auto') -> Optional[Any]
VictorBaseModel
save(session: VictorSession) -> Selfdelete(session: VictorSession) -> Nonerefresh(session: VictorSession) -> Selfget(session: VictorSession, id_: int) -> Optional[Self]all_ids(session: VictorSession) -> List[int]query_eq(session: VictorSession, field: str, value: Any) -> List[Self]
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file victordb-0.1.3.tar.gz.
File metadata
- Download URL: victordb-0.1.3.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
361aa602d412514d96f2971d869067763ba83b634b622d426bff67fe8992bf84
|
|
| MD5 |
8406305e353630c7f18be689dcd71bc9
|
|
| BLAKE2b-256 |
d4f55af4617055b0ad117332a1f66425e8afc895bc43b73d460861652e06fbce
|
File details
Details for the file victordb-0.1.3-py3-none-any.whl.
File metadata
- Download URL: victordb-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab79ad3337c663bc8a68329cbeb1ce90dfc2bc9cacc567b7af0d039c080bc3c2
|
|
| MD5 |
960fd29c81d6fb0f9977031c2819e33c
|
|
| BLAKE2b-256 |
1e4931c631c97ff69b8b016c962fdec3659806ee2dad1a1c4635bea16ca6386b
|