Skip to main content

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.

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]) -> int
  • delete(id: int) -> bool
  • search(vector: List[float], topk: int) -> List[Tuple[int, float]]

VictorTableClient

  • put(key: bytes, value: bytes) -> bool
  • get(key: bytes) -> Optional[bytes]
  • delete(key: bytes) -> bool
  • to_bytes(value: Any) -> bytes
  • from_bytes(data: bytes, target_type: str = 'auto') -> Any

VictorSession

  • new_id() -> int
  • kv_put(key: str, value: Any) -> None
  • kv_get(key: str, target_type='auto') -> Optional[Any]

VictorBaseModel

  • save(session: VictorSession) -> Self
  • delete(session: VictorSession) -> None
  • refresh(session: VictorSession) -> Self
  • get(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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

victordb-0.1.6.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

victordb-0.1.6-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file victordb-0.1.6.tar.gz.

File metadata

  • Download URL: victordb-0.1.6.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for victordb-0.1.6.tar.gz
Algorithm Hash digest
SHA256 11f28a1c866415a4059e6506392612e59e7d227c1d3dd1cba429d5cdcad9c904
MD5 7404b262e5ea5cdb6c6939f20502ac14
BLAKE2b-256 0c2c1a41922550a61ee4e21ef0cfdd5a6cb5d86340b7188742b08cdf6767f4c2

See more details on using hashes here.

File details

Details for the file victordb-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: victordb-0.1.6-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

Hashes for victordb-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5e88e369f18a9c7ba601bb4806c921f0ff2b0e467b722c89500ab94d8cc883d4
MD5 cbb65a0d27ef8eb60a82f741c58e6e7d
BLAKE2b-256 3e841e24e7e363480eb8b13b8a7abd34dc913d11ea2ced74b4e51397e3259897

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page