Skip to main content

Embeddable property graph database with GQL query language, graph algorithms, and Python bindings

Project description

minigdb

Crates.io docs.rs License: MPL 2.0

An embedded property-graph database built in Rust on RocksDB. Property graph model (nodes and edges with labels and key-value properties), ACID-compliant RocksDB-backed storage, and a GQL (ISO/IEC 39075) query language subset — usable as a REPL, a network server, or an embedded Rust/Python library.

Feature highlights:

  • GQL queries: MATCH, INSERT, SET, DELETE, variable-length paths, OPTIONAL MATCH, UNION, aggregates, WITH, UNWIND
  • 15 built-in graph algorithms: PageRank, shortest path, community detection (Louvain/Leiden), centrality measures, max-flow, and more
  • Property indexes with automatic pushdown for equality, range, and startsWith() prefix queries; uniqueness and type constraints, parameterized queries, CSV bulk import
  • Multi-graph support, explicit transactions with O(ops-in-transaction) adjacency rollback
  • TCP server with authentication, per-connection transaction isolation, and an embedded web GUI
  • Python bindings via PyO3 with polars/pandas DataFrame output

Quick Start

Requires Rust (install via rustup).

# Build and launch the interactive REPL
cargo run

# Or build first, then run the binary directly
cargo build
./target/debug/minigdb

# Run the test suite
cargo test

Data is stored in the platform user-data directory:

Platform Path
Linux ~/.local/share/minigdb/
macOS ~/Library/Application Support/minigdb/
Windows %AppData%\minigdb\

The REPL prints the active data directory on startup. Each named graph gets its own graphs/<name>/ subfolder.


REPL

The REPL auto-detects complete statements, so semicolons are optional. Multi-line input is supported; the prompt shows -> until the statement is complete (or txn-> inside a transaction). Input history is saved to .minigdb_history in the current directory.

Meta-commands

Command Effect
:graphs List all graphs across all registered roots, marking the active one
:create <name> Create a new named graph and switch to it
:use <name> Checkpoint the current graph and switch to an existing one
:drop <name> Permanently delete a named graph
:checkpoint Force a snapshot and truncate the WAL immediately
:locations List registered graph-root directories
:add-location <path> Register an additional graph-root directory (persisted)
:remove-location <path> Remove a registered graph-root directory (persisted)
:quit or :q Exit (writes a final checkpoint)
Ctrl-C Cancel the current input line
Ctrl-D Exit

Graph management commands are not allowed inside a BEGIN transaction.


Example queries

INSERT (:Person {name: "Alice", age: 30})
INSERT (:Person {name: "Bob",   age: 25})
MATCH (a:Person {name: "Alice"}), (b:Person {name: "Bob"})
INSERT (a)-[:KNOWS]->(b)

MATCH (a)-[:KNOWS]->(b) RETURN a.name, b.name
CALL pageRank() YIELD node, score RETURN node, score ORDER BY score DESC

Documentation

Topic Description
Query Language Full GQL reference: INSERT, MATCH, WHERE, aggregates, path quantifiers, indexes, constraints, transactions
Graph Algorithms 15 algorithms invoked via CALL … YIELD: PageRank, shortest path, centrality, community detection, max-flow
Network Server TCP server, authentication, web GUI, wire protocol, HTTP API
Python API Installation, local/remote usage, DataFrame output, parameterized queries, CSV import

Storage

Each named graph is stored in its own graphs/<name>/ subdirectory, backed by RocksDB using eight column families:

Column Family Contents
nodes Node records (ID → bincode-serialized Node)
edges Edge records (ID → bincode-serialized Edge)
adj_out Outgoing adjacency index
adj_in Incoming adjacency index
label_idx Label → node ID set
edge_label_idx Edge label → edge ID set
prop_idx Property index (label + key + encoded value → node ID set)
meta Graph metadata (index definitions, constraint definitions)

RocksDB provides atomic writes via WriteBatch, crash recovery via SST compaction, and supports graphs that exceed available RAM through its internal block cache.


Architecture

src/
├── main.rs           # REPL (rustyline, graph management commands, server entry points)
├── lib.rs            # Public API and re-exports
├── gql.pest          # PEG grammar (pest, read at compile time)
├── python.rs         # Python bindings (PyO3, feature = "python")
├── csv_import.rs     # CSV bulk import
├── types/            # Value, NodeId (ULID), EdgeId (ULID), Node, Edge, DbError
├── graph/            # Graph struct + RocksDB-backed mutation helpers (ops.rs, constraints.rs)
├── storage/          # RocksStore (8 CFs), StorageManager, apply_ops replay helper
├── transaction/      # Operation enum (WAL replay units)
├── algorithms/       # 15 graph algorithm modules dispatched via CALL
├── query/            # AST, pest parser, tree-walking executor
└── server/
    ├── mod.rs        # Async TCP server, auth handshake, per-connection state
    ├── auth.rs       # ServerConfig, UserEntry, SHA-256 password hashing
    ├── registry.rs   # GraphRegistry — lazy-open, Arc<Mutex> per graph
    ├── protocol.rs   # Request/Response/ClientMessage/ServerMessage types
    └── http.rs       # Axum HTTP server + embedded GUI (feature = "gui")

Cargo features

Feature Included in default Description
repl yes Interactive REPL (rustyline, readline history)
server yes TCP server (tokio, SHA-256 auth)
gui yes Embedded HTTP GUI (axum); requires server
python no PyO3 Python bindings; build with maturin develop --features python

License

minigdb is distributed under the GNU Lesser General Public License v3.0.

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

minigdb-0.1.2.tar.gz (305.2 kB view details)

Uploaded Source

Built Distributions

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

minigdb-0.1.2-cp39-abi3-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

minigdb-0.1.2-cp39-abi3-manylinux_2_28_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ x86-64

minigdb-0.1.2-cp39-abi3-manylinux_2_28_aarch64.whl (4.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

minigdb-0.1.2-cp39-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl (6.9 MB view details)

Uploaded CPython 3.9+macOS 10.13+ universal2 (ARM64, x86-64)macOS 10.13+ x86-64macOS 11.0+ ARM64

File details

Details for the file minigdb-0.1.2.tar.gz.

File metadata

  • Download URL: minigdb-0.1.2.tar.gz
  • Upload date:
  • Size: 305.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for minigdb-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8278db0b59abc2cefb997564d2116a1051d9102156e4d25cb0aa586dea7668a8
MD5 5c7dabd23f99b998664653c094d95cd2
BLAKE2b-256 d1b1f355644717c46809255777e913d4eb36a46cb92e17199a657548eaa92b52

See more details on using hashes here.

Provenance

The following attestation bundles were made for minigdb-0.1.2.tar.gz:

Publisher: release.yml on jerichomcleod/minigdb

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

File details

Details for the file minigdb-0.1.2-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: minigdb-0.1.2-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for minigdb-0.1.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 589cb960fe9ed8458dfb512e3792ef363fb3625ef7c0849dc070a0854dc3bc1e
MD5 0c1c84efef6f8ade151f01a21c483e41
BLAKE2b-256 52bbde7772b0350878785d71b28564497cd9d36eb6d44eb55b5e020243bd464d

See more details on using hashes here.

Provenance

The following attestation bundles were made for minigdb-0.1.2-cp39-abi3-win_amd64.whl:

Publisher: release.yml on jerichomcleod/minigdb

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

File details

Details for the file minigdb-0.1.2-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for minigdb-0.1.2-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c27ad5cd06ff42745628d11ac81eeed793e1286127af3842c728147a6d8af54e
MD5 ebb451791e8bf198fe5919fab963ecc9
BLAKE2b-256 54f7d705e4829683460f61a54b2f7c461b92c643e92753cf7b432eb4c16f9c43

See more details on using hashes here.

Provenance

The following attestation bundles were made for minigdb-0.1.2-cp39-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on jerichomcleod/minigdb

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

File details

Details for the file minigdb-0.1.2-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for minigdb-0.1.2-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 79e6d8b6baa51d3a8d790a0ac64e73024691f7ea831473ed5f17bc9079b55f3e
MD5 3c9dbbc9449f6aee80ef7b6429f4cd86
BLAKE2b-256 e1f69111f602c1cbe3ade4125a800484b29ec55a69f492589693c44d8010bb60

See more details on using hashes here.

Provenance

The following attestation bundles were made for minigdb-0.1.2-cp39-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on jerichomcleod/minigdb

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

File details

Details for the file minigdb-0.1.2-cp39-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl.

File metadata

File hashes

Hashes for minigdb-0.1.2-cp39-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl
Algorithm Hash digest
SHA256 a3fd31586a223532e24432efd6691e237b43c60c43fb6e1580ba0ffd953fbfc8
MD5 3f3590c32629b1e0da6f9deb83220662
BLAKE2b-256 d56eb62f91a4802aab83163a516f7d0e281c95ea91f99f8fee493d9dd58aae2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for minigdb-0.1.2-cp39-abi3-macosx_10_13_x86_64.macosx_11_0_arm64.macosx_10_13_universal2.whl:

Publisher: release.yml on jerichomcleod/minigdb

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