victordb


Namevictordb JSON
Version 0.1.4 PyPI version JSON
download
home_pageNone
SummaryVictorDB 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.
upload_time2025-08-18 23:08:15
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords vector database key-value orm python database victordb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```bash
pip install victordb
```

## Quick Start

```python
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`:

```python
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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "victordb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "vector database, key-value, orm, python, database, VictorDB",
    "author": null,
    "author_email": "Emiliano Billi <emiliano.billi@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/51/ba/86f3f707ae943d57e1b5842973c1af81ead6d9962b4d4be6e7d6bfd1c8ed/victordb-0.1.4.tar.gz",
    "platform": null,
    "description": "# VictorDB Python Client\n\nVictorDB 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.\n\n- Library Core (libvictor):  https://github.com/victor-base/libvictor\n- Database (victordb): https://github.com/victor-base/victordb\n\n## Features\n\n- Vector index operations: insert, search, delete\n- Key-value table operations: put, get, delete\n- ORM-style data modeling with secondary indexes\n- High-performance, binary protocol (CBOR)\n- Pluggable and extensible design\n\n## Installation\n\n```bash\npip install victordb\n```\n\n## Quick Start\n\n```python\nfrom victordb.victor import VictorIndexClient, VictorTableClient, VictorSession, VictorBaseModel\n\n# Connect to VictorDB server (vector index)\nindex_client = VictorIndexClient()\nindex_client.connect(host=\"localhost\", port=9000)\n\n# Insert a vector\nindex_client.insert(id=123, vector=[0.1, 0.2, 0.3])\n\n# Search for similar vectors\nresults = index_client.search(vector=[0.1, 0.2, 0.3], topk=5)\nprint(results)\n\n# Connect to VictorDB server (key-value table)\ntable_client = VictorTableClient()\ntable_client.connect(host=\"localhost\", port=9001)\n\n# Store and retrieve a value\ntable_client.put(b\"mykey\", b\"myvalue\")\nvalue = table_client.get(b\"mykey\")\nprint(value)\n```\n\n## ORM Example\n\nDefine your own models by inheriting from `VictorBaseModel`:\n\n```python\nfrom victordb.victor import VictorSession, VictorTableClient, VictorBaseModel\nfrom dataclasses import dataclass, field\n\n@dataclass\nclass User(VictorBaseModel):\n    __classname__ = \"User\"\n    __indexed__ = [\"email\"]\n    email: str = \"\"\n    name: str = \"\"\n\n# Connect to table and create session\ntable = VictorTableClient()\ntable.connect(host=\"localhost\", port=9001)\nsession = VictorSession(table)\n\n# Create and save a user\nuser = User(email=\"alice@example.com\", name=\"Alice\")\nuser.save(session)\n\n# Query by indexed field\nusers = User.query_eq(session, \"email\", \"alice@example.com\")\nprint(users)\n```\n\n## API Overview\n\n### VictorIndexClient\n\n- `insert(id: int, vector: List[float]) -> int`\n- `delete(id: int) -> bool`\n- `search(vector: List[float], topk: int) -> List[Tuple[int, float]]`\n\n### VictorTableClient\n\n- `put(key: bytes, value: bytes) -> bool`\n- `get(key: bytes) -> Optional[bytes]`\n- `delete(key: bytes) -> bool`\n- `to_bytes(value: Any) -> bytes`\n- `from_bytes(data: bytes, target_type: str = 'auto') -> Any`\n\n### VictorSession\n\n- `new_id() -> int`\n- `kv_put(key: str, value: Any) -> None`\n- `kv_get(key: str, target_type='auto') -> Optional[Any]`\n\n### VictorBaseModel\n\n- `save(session: VictorSession) -> Self`\n- `delete(session: VictorSession) -> None`\n- `refresh(session: VictorSession) -> Self`\n- `get(session: VictorSession, id_: int) -> Optional[Self]`\n- `all_ids(session: VictorSession) -> List[int]`\n- `query_eq(session: VictorSession, field: str, value: Any) -> List[Self]`\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "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.",
    "version": "0.1.4",
    "project_urls": null,
    "split_keywords": [
        "vector database",
        " key-value",
        " orm",
        " python",
        " database",
        " victordb"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bb2e5b58d274329b6a2f1cf6b33ae251393cee4fda0d4556fec2f66e4b977202",
                "md5": "d06ae17fcf0b6ee2ebc1d8a2610eaaee",
                "sha256": "06ef5a6aaf0aa65ec510b5e5c1d4197247118518a3f47a9c01164d9acfb8dfbe"
            },
            "downloads": -1,
            "filename": "victordb-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d06ae17fcf0b6ee2ebc1d8a2610eaaee",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9077,
            "upload_time": "2025-08-18T23:08:12",
            "upload_time_iso_8601": "2025-08-18T23:08:12.391592Z",
            "url": "https://files.pythonhosted.org/packages/bb/2e/5b58d274329b6a2f1cf6b33ae251393cee4fda0d4556fec2f66e4b977202/victordb-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "51ba86f3f707ae943d57e1b5842973c1af81ead6d9962b4d4be6e7d6bfd1c8ed",
                "md5": "178d219ff9f2f99fb60a3ac27fbc14ce",
                "sha256": "11c5b3be0ecf2c5620ca88b2d122dd25486c269e5e0cc4be2c9345fe8a52dfba"
            },
            "downloads": -1,
            "filename": "victordb-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "178d219ff9f2f99fb60a3ac27fbc14ce",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9861,
            "upload_time": "2025-08-18T23:08:15",
            "upload_time_iso_8601": "2025-08-18T23:08:15.053122Z",
            "url": "https://files.pythonhosted.org/packages/51/ba/86f3f707ae943d57e1b5842973c1af81ead6d9962b4d4be6e7d6bfd1c8ed/victordb-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-18 23:08:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "victordb"
}
        
Elapsed time: 0.62872s