Skip to main content

High-performance multi-model database — KV, Graph, SQL, Vector Search, Full-Text Search

Project description

aresadb

Python bindings for AresaDB — a high-performance multi-model database engine in Rust.

Key-Value · Graph · SQL · Vector Search · Full-Text Search — all from Python.

Install

pip install aresadb
# or
uv add aresadb

Quick Start

from aresadb_python import Database

db = Database.create("./mydata", "demo")

# Insert nodes
user = db.insert_dict("user", {"name": "Alice", "age": 30})

# Batch insert
nodes = db.insert_batch([
    ("user", {"name": "Bob", "age": 25}),
    ("user", {"name": "Charlie", "age": 35}),
])

# Get / Update / Delete
node = db.get(user.id)
updated = db.update(user.id, {"name": "Alice", "age": 31})
db.delete(user.id)

# List by type
users = db.get_by_type("user", limit=100)

SQL Queries

result = db.query("SELECT * FROM user WHERE age > 28 ORDER BY name LIMIT 10")
for row in result.rows:
    print(dict(zip(result.columns, row)))

db.query("INSERT INTO product (name, price) VALUES ('Widget', 9.99)")
db.query("UPDATE user SET age = 31 WHERE name = 'Alice'")
db.query("DELETE FROM user WHERE age < 18")

Graph (Edges & Traversal)

alice = db.insert_dict("user", {"name": "Alice"})
bob = db.insert_dict("user", {"name": "Bob"})
charlie = db.insert_dict("user", {"name": "Charlie"})

# Create edges (with optional properties)
edge = db.create_edge(alice.id, bob.id, "follows", {"since": "2024"})

# Batch edges
db.create_edges_batch([
    (bob.id, charlie.id, "follows"),
    (alice.id, charlie.id, "knows"),
])

# Query edges
outgoing = db.get_edges_from(alice.id)
incoming = db.get_edges_to(charlie.id, edge_type="follows")
db.delete_edge(edge.id)

# BFS traversal
result = db.traverse(alice.id, max_depth=3, edge_types=["follows"])
print(f"Visited {len(result.nodes)} nodes over {result.depth} hops")
print(result.adjacency)  # {node_id: [neighbor_ids]}

# Shortest path
path = db.shortest_path(alice.id, charlie.id)
if path:
    print(" -> ".join(n.properties.get("name", n.id) for n in path))

# Connected components
components = db.connected_components("user")
print(f"{len(components)} component(s)")

Secondary Indexes

db.create_index("user", "age")        # B-tree index
results = db.index_lookup("user", "age", 30)
db.list_indexes()                      # [("user", "age")]
db.drop_index("user", "age")

Full-Text Search (BM25)

db.insert("article", '{"title": "Rust", "body": "Rust is a systems language"}')
db.insert("article", '{"title": "Python", "body": "Python is great for ML"}')

db.create_fulltext_index("article", "body")

results = db.fulltext_search("article", "body", "Rust systems", limit=5)
for r in results:
    print(f"Score: {r.score:.3f}  Node: {r.node.properties}")

db.list_fulltext_indexes()  # [("article", "body")]

Vector Search (HNSW)

# Insert with embedding
doc = db.insert_with_embedding(
    "document",
    '{"title": "ML Intro"}',
    "embedding",
    [0.9, 0.1, 0.0, 0.0],
)

# k-NN search (HNSW-accelerated)
results = db.similarity_search(
    query_vector=[1.0, 0.0, 0.0, 0.0],
    node_type="document",
    field="embedding",
    k=10,
    metric="cosine",  # cosine | euclidean | dot | manhattan
)

# Radius search (exact, brute-force)
near = db.similarity_search_radius(
    [1.0, 0.0, 0.0, 0.0], "document", "embedding",
    max_distance=0.5, metric="euclidean",
)

# Retrieve node + embedding
node, vec = db.get_node_with_embedding(doc.id, "embedding")

# Rebuild HNSW index after bulk inserts
stats = db.rebuild_vector_index("document", "embedding")
print(f"{stats.num_vectors} vectors, dim={stats.dimension}")

Introspection

status = db.status()
print(f"{status.name}: {status.node_count} nodes, {status.edge_count} edges, {status.size_bytes} bytes")
print(db.name(), db.path())

Type Stubs

A .pyi stub file ships with the package for full IDE autocompletion and type checking.

Running Tests

cd python/
uv venv .venv && source .venv/bin/activate
uv pip install maturin pytest
maturin develop --release
pytest tests/ -v

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

aresadb-0.2.0.tar.gz (242.9 kB view details)

Uploaded Source

Built Distributions

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

aresadb-0.2.0-cp313-cp313-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

aresadb-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

aresadb-0.2.0-cp312-cp312-manylinux_2_38_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ x86-64

aresadb-0.2.0-cp312-cp312-manylinux_2_38_aarch64.whl (8.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ ARM64

aresadb-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

aresadb-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

aresadb-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

aresadb-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

aresadb-0.2.0-cp310-cp310-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

aresadb-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

aresadb-0.2.0-cp39-cp39-macosx_11_0_arm64.whl (5.5 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

aresadb-0.2.0-cp39-cp39-macosx_10_12_x86_64.whl (5.7 MB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

File details

Details for the file aresadb-0.2.0.tar.gz.

File metadata

  • Download URL: aresadb-0.2.0.tar.gz
  • Upload date:
  • Size: 242.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aresadb-0.2.0.tar.gz
Algorithm Hash digest
SHA256 342e8bb05ea2086756696f619f4760b7c9f4f042064c26b039771ad292bd067b
MD5 e68c4515cf6cc28468b7f2791656ed73
BLAKE2b-256 768d6809dec43f02a271d0d84dba0156c2a34bcf3822e7bf621716a8c356a5b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0.tar.gz:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 055e4823739952c242f2725e56edc3bde1b79d68fc5a7999fd9acf8a79e836b7
MD5 8229ffce94dbbcc6c91c13123d693b75
BLAKE2b-256 0eae1941d0cb08d7633584fb77c31499a72883350790228f43b8f724bd24918e

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9db46fc292bcf989aecec2d9df96c64b1e7cce3db954c43e6863ee24fb811d1c
MD5 ee0a02ff1967d70f42c9af7e4f5fa2c8
BLAKE2b-256 6cfa2156042504850574820719532186296e7745c5b9a8c9ad0f794d778be97f

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp312-cp312-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 ec647761f32e6c3d3dfb2f8e710eee47a8444b738557884e3ce82fb0ca708157
MD5 ad59f982af7ef97ab6efe1c42bc9756c
BLAKE2b-256 96c21cb2dd3d1d1db02738335d1acfc026ec6d6df5f4396dcbeae7acb525941f

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp312-cp312-manylinux_2_38_x86_64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp312-cp312-manylinux_2_38_aarch64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp312-cp312-manylinux_2_38_aarch64.whl
Algorithm Hash digest
SHA256 f552f96a22d6fba8e212b536bb27e0e1e0b8304213299345f2e76813deeb81e5
MD5 9a207c81c377b30f2fd3c2f02c3f56e4
BLAKE2b-256 fe58dd85142884e048fcec135dc1052e80f38dcaef5d99d83868f85a9613c4d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp312-cp312-manylinux_2_38_aarch64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f9b494bab69ae157156c56495192e32ff8514c1a78e147551406cf2f3d41fd5
MD5 b55a6f93119a94551dcc117f4f963f41
BLAKE2b-256 1b95d2f0e10075125830c4bde2b4cde0ca1b9689ca67e56484c905a72a4cb5c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7fe748cefae8dde0bbb68408b0ef84013125eba7c9140cc92d77f8be5afb8063
MD5 98821b1a3327bf1f562d87be5d1c81ac
BLAKE2b-256 db86c9ca67147c38df54bcb72ce28be834311daa5592d138e912db8a94806ed1

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48a20444a7e1086766545338d933e055546879cd22e8b0e4ba86590cbcd44e41
MD5 351d53f85ef0a28872d56ebc26634d97
BLAKE2b-256 ce7a8eeb681db7292b850803c80089df0cbe9e11a0143dc9db747251d900387c

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 58d4810b087065430d4477d217a674f2fe44525aeb40cd9a35cdeb16acb5a955
MD5 3364ecf6b1ebe27eb958bce99a637421
BLAKE2b-256 5496155509b008669bccb4c5c394fa8ac80f95959c45a1f547cade3b997475e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa8b37c38a3768ed3fd124201a7c4afb59828c4ae81dc161e0e59ded62a86fec
MD5 7bc1e9337ad8518e92734cab2dd1a4db
BLAKE2b-256 55fea6b6a718c3fbf2f16c568f9c408e94d5bfd5043bddb805ea39ecafdc4628

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4852393f3869172d291a17be744eb5ac4a8780956ae346d82251afc0fc53c8e6
MD5 8c1829b3f2a95490def82dffc95d2f74
BLAKE2b-256 c4af62838a281ebbb042964b90e182999b5b83b7a10b46e9ce2f03b4560dab81

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 814cf956c930951c3c1c6c76b1b0ba7190a1a90d1582b93a69e97245a349a817
MD5 7dd9c8f00fa744cd11502f528cf27952
BLAKE2b-256 a039be3ce11bc8b833b01c83c07f2634c48086e650b2ee203547d6c1ef207181

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aresadb-0.2.0-cp39-cp39-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for aresadb-0.2.0-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6f8ccd15cb6b09342e967c157f59d820a6135067c0dc32ffe37c4c29c3796fe6
MD5 07bd0a6856b1a418fbcdad53e58ff74e
BLAKE2b-256 33cb88d4ff5cea30f325ea0d0b2051a931a2f6155813de05089577933ee7a44f

See more details on using hashes here.

Provenance

The following attestation bundles were made for aresadb-0.2.0-cp39-cp39-macosx_10_12_x86_64.whl:

Publisher: release.yml on yoreai/aresadb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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