Embedded graph database with HNSW vector search — Python bindings to the sqlitegraph Rust crate.
Project description
sqlitegraph
Python bindings to the sqlitegraph
embedded graph database. Storage, graph algorithms, and HNSW vector search
run in a reviewed Rust core; this package is the Pythonic surface.
Alpha — API subject to change before 1.0.
Install
pip install sqlitegraph
Quick start
from sqlitegraph import Graph
g = Graph.open_in_memory()
alice = g.add_node(kind="User", name="Alice", data={"age": 30})
order = g.add_node(kind="Order", name="Order-123")
g.add_edge(alice, order, "placed")
print(g.neighbors(alice))
Query language
Graph.query() exposes the same Cypher-inspired language as the CLI:
from sqlitegraph import Graph
g = Graph.open_in_memory()
alice = g.add_node(kind="User", name="Alice", data={"age": 30})
bob = g.add_node(kind="User", name="Bob", data={"age": 31})
g.add_edge(alice, bob, "KNOWS")
result = g.query("MATCH (a:User)-[:KNOWS]->(b:User) RETURN a.name, b.name")
print(result["results"])
Supported query features include node scans, edge traversal, multi-hop chains,
star/multi-pattern joins, variable-depth edges, WHERE with regex/numeric
operators and parentheses, LIMIT, CREATE, SET, DELETE, and HNSW vector
search through CALL db.index.vector.queryNodes(...).
Algorithms
from sqlitegraph import Graph
g = Graph.open_in_memory()
a = g.add_node(kind="Page", name="A")
b = g.add_node(kind="Page", name="B")
c = g.add_node(kind="Page", name="C")
g.add_edge(a, b, "LINKS")
g.add_edge(b, c, "LINKS")
g.add_edge(c, a, "LINKS")
print(g.pagerank(iterations=20))
print(g.connected_components())
print(g.strongly_connected_components())
print(g.label_propagation(50))
print(g.find_cycles(10))
print(g.dominators(a))
critical_path() is also available for directed acyclic graphs and returns
{"path": [...], "distance": float, "path_length": int}.
HNSW vector search
from sqlitegraph import Graph
g = Graph.open_in_memory()
idx = g.create_hnsw_index("embeddings", dimension=3, metric="cosine")
idx.insert_vector([1.0, 0.8, 0.1], {"label": "graph databases"})
idx.insert_vector([0.1, 0.2, 1.0], {"label": "baking"})
print(idx.search([1.0, 0.9, 0.0], 1))
print(g.list_hnsw_indexes())
g.delete_hnsw_index("embeddings")
Examples
The examples/ directory contains runnable scripts:
| Example | What it shows |
|---|---|
01_basic_crud.py |
Nodes, edges, update, delete, query by kind/pattern, degrees |
02_graph_algorithms.py |
BFS, k-hop, shortest path, PageRank, Louvain & label-propagation communities, connected components (WCC), strongly-connected components (SCC), cycle search, dominator tree, critical path |
03_vector_search.py |
HNSW index creation, insert, search, bulk insert, index listing |
04_social_network.py |
Realistic network: influencers (PageRank), communities, connection paths, mutual follows |
05_file_backed.py |
Persistent Graph.open(path), checkpoint, reopen, cleanup |
06_hybrid_sqlite_hnsw_query.py |
sqlite3 application rows + sqlitegraph metadata + HNSW + Graph.query() expansion |
Run any example from the repo root:
cd sqlitegraph-py
source .venv/bin/activate
python examples/01_basic_crud.py
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
Built Distributions
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 sqlitegraph-0.4.1.tar.gz.
File metadata
- Download URL: sqlitegraph-0.4.1.tar.gz
- Upload date:
- Size: 986.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80332385992576fa8a4c098ee9c7063f4d3362365f81ef72a03731a3e05ed705
|
|
| MD5 |
95301c36987709612acbc5f589feec6b
|
|
| BLAKE2b-256 |
6971ed32e6027b384e89407d51dfbf50246744d3cfa5c2d3ec9195c4b586838f
|
Provenance
The following attestation bundles were made for sqlitegraph-0.4.1.tar.gz:
Publisher:
wheels.yml on oldnordic/sqlitegraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlitegraph-0.4.1.tar.gz -
Subject digest:
80332385992576fa8a4c098ee9c7063f4d3362365f81ef72a03731a3e05ed705 - Sigstore transparency entry: 1566066268
- Sigstore integration time:
-
Permalink:
oldnordic/sqlitegraph@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Branch / Tag:
refs/tags/py-v0.4.1 - Owner: https://github.com/oldnordic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlitegraph-0.4.1-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: sqlitegraph-0.4.1-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ca35e2c13099ba92fb584eefe8734e22a33d9e64f51359edea13af97c9dbace
|
|
| MD5 |
3e7dfe910a060b0a25b72bcd9619b941
|
|
| BLAKE2b-256 |
4eb94921f219752537f3f1ce7da602eb7900b39334b2548ebb452330d32aad2c
|
Provenance
The following attestation bundles were made for sqlitegraph-0.4.1-cp310-abi3-win_amd64.whl:
Publisher:
wheels.yml on oldnordic/sqlitegraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlitegraph-0.4.1-cp310-abi3-win_amd64.whl -
Subject digest:
8ca35e2c13099ba92fb584eefe8734e22a33d9e64f51359edea13af97c9dbace - Sigstore transparency entry: 1566066302
- Sigstore integration time:
-
Permalink:
oldnordic/sqlitegraph@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Branch / Tag:
refs/tags/py-v0.4.1 - Owner: https://github.com/oldnordic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlitegraph-0.4.1-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: sqlitegraph-0.4.1-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aef6be42aff6cac212d538358319a059e2552af3f67ba6e933c5273a82943204
|
|
| MD5 |
ee033724d75160abf7a9962ae090431c
|
|
| BLAKE2b-256 |
70a58ccf69f003e04e0c9cc4f461fd1271a5326447daa68dc381c5ec96be9c87
|
Provenance
The following attestation bundles were made for sqlitegraph-0.4.1-cp310-abi3-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on oldnordic/sqlitegraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlitegraph-0.4.1-cp310-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
aef6be42aff6cac212d538358319a059e2552af3f67ba6e933c5273a82943204 - Sigstore transparency entry: 1566066327
- Sigstore integration time:
-
Permalink:
oldnordic/sqlitegraph@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Branch / Tag:
refs/tags/py-v0.4.1 - Owner: https://github.com/oldnordic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlitegraph-0.4.1-cp310-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: sqlitegraph-0.4.1-cp310-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd47865933c9ff2fb054e0de40318f4e3dd394e7c36ac961bae9c201d57fe044
|
|
| MD5 |
f689bb69db036038287d277358659306
|
|
| BLAKE2b-256 |
0096bebe1ac5bdbf462594a398b206099e0a4805f59593b84af4263bb9085b60
|
Provenance
The following attestation bundles were made for sqlitegraph-0.4.1-cp310-abi3-manylinux_2_28_aarch64.whl:
Publisher:
wheels.yml on oldnordic/sqlitegraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlitegraph-0.4.1-cp310-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
fd47865933c9ff2fb054e0de40318f4e3dd394e7c36ac961bae9c201d57fe044 - Sigstore transparency entry: 1566066276
- Sigstore integration time:
-
Permalink:
oldnordic/sqlitegraph@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Branch / Tag:
refs/tags/py-v0.4.1 - Owner: https://github.com/oldnordic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlitegraph-0.4.1-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: sqlitegraph-0.4.1-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9ba3b07311e1ba92e00dce28287341b9b0fb40eab8d9b9338ed1bf4cdebbff5
|
|
| MD5 |
6be34e18c47ad7936daa1f0f05f2527f
|
|
| BLAKE2b-256 |
2d233c7821444c2c708cd27dca841ab73b5a7ae3f8ab602169ce51afb113d44f
|
Provenance
The following attestation bundles were made for sqlitegraph-0.4.1-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on oldnordic/sqlitegraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlitegraph-0.4.1-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
b9ba3b07311e1ba92e00dce28287341b9b0fb40eab8d9b9338ed1bf4cdebbff5 - Sigstore transparency entry: 1566066315
- Sigstore integration time:
-
Permalink:
oldnordic/sqlitegraph@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Branch / Tag:
refs/tags/py-v0.4.1 - Owner: https://github.com/oldnordic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sqlitegraph-0.4.1-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: sqlitegraph-0.4.1-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
982d01039f126395eb5fe051e779dba8231569f4b1fd660719f76d096cebb868
|
|
| MD5 |
7c81bd7e10bdaabc13f66cfc4d2dc593
|
|
| BLAKE2b-256 |
fc976ec8ba11399107068fff46f3bab1c08929f71ccd6ee9147fa61ac5b29488
|
Provenance
The following attestation bundles were made for sqlitegraph-0.4.1-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
wheels.yml on oldnordic/sqlitegraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlitegraph-0.4.1-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
982d01039f126395eb5fe051e779dba8231569f4b1fd660719f76d096cebb868 - Sigstore transparency entry: 1566066288
- Sigstore integration time:
-
Permalink:
oldnordic/sqlitegraph@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Branch / Tag:
refs/tags/py-v0.4.1 - Owner: https://github.com/oldnordic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4d8f037d8338ba7ba38813b4857bdbc7974bd9a5 -
Trigger Event:
push
-
Statement type: