Velr
Velr is an embedded property-graph database from Velr.ai, written in Rust, built on top of SQLite3 (persisting to a standard SQLite database file) and queried using the openCypher language.
This crate provides the Rust binding for Velr. It links against a bundled native runtime with a C ABI, implemented in Rust.
For the main Velr public entry point, see velr-ai/velr.
For the Velr website, see velr.ai.
Community
- Community and questions: GitHub Discussions
- Bug reports and feature requests: GitHub Issues
- Rust examples: velr-rust-examples
We’d love to have you join the Velr community.
Release status
This release is alpha.
- The API and query support are still evolving.
- openCypher coverage is already substantial, but some features are still missing.
Velr is already usable for real workflows and representative use cases, but rough edges remain and the API is not yet stable.
Velr 1.0 is focused on strong openCypher compatibility.
Vector search, time-series, and federation are planned as post-1.0 capabilities.
Installation
Add to Cargo.toml:
[]
= "0.2"
Enable Arrow IPC support (binding Arrow arrays + exporting result tables as Arrow IPC):
[]
= { = "0.2", = ["arrow-ipc"] }
Quick start
use ;
Query language support
Velr supports most of openCypher, but some features are not yet implemented.
Notable missing features:
REMOVEclause- Query parameters (for example
$name) - The query planner does not yet use indexes in all cases where expected.
Streaming multiple result tables
A single exec() can yield multiple result tables (e.g. multiple statements):
let db = open?;
let mut stream = db.exec?;
while let Some = stream.next_table?
Transactions and savepoints
Velr supports transactions together with two kinds of savepoints:
- Scoped savepoints via
savepoint(), which return a guard - Named savepoints via
savepoint_named(name), which remain active in the transaction until released or the transaction ends
Calling rollback_to(name) rolls back to the named savepoint, discards any newer named savepoints, and keeps the target savepoint active.
Scoped savepoint
let db = open?;
let tx = db.begin_tx?;
tx.run?;
tx.commit?;
Named savepoints
let db = open?;
let tx = db.begin_tx?;
tx.savepoint_named?;
tx.run?;
tx.savepoint_named?;
tx.run?;
tx.rollback_to?;
tx.run?;
tx.release_savepoint?;
tx.commit?;
release_savepoint(name) currently releases the most recent active named savepoint.
Dropping an active transaction without commit() will roll it back automatically.
Explain plans
Velr can produce an explain trace for a query, which is useful when you want to inspect how a openCypher query is planned and translated internally.
Use Velr::explain to build a trace without executing the query:
use Velr;
The returned ExplainTrace can be inspected programmatically or rendered as a compact string for logging, debugging, tests, or documentation.
Arrow IPC (optional)
With features = ["arrow-ipc"] you can:
- Bind Arrow arrays as a logical table (
bind_arrow,bind_arrow_chunks) - Export a result table as an Arrow IPC file (
to_arrow_ipc_file())
Supported functions
Velr currently supports these openCypher functions:
Scalars
id()type()length()nodes()relationships()coalesce()labels()properties()keys()
Aggregates
count()sum()avg()min()max()collect()
Platform support
This crate links against a bundled native runtime.
Currently bundled targets:
* macOS universal (arm64 + x86_64)
* Linux x86_64
* Linux aarch64
* Windows x86_64
Licensing
- The Rust binding source code in this package is licensed under MIT.
- The bundled native runtime binaries may be used and freely redistributed in unmodified form under the terms of
LICENSE.runtime.
See LICENSE and LICENSE.runtime for the full license texts.