Welcome to Runic

Graph schema migrations and ORM for Cypher-based graph databases.

PyPI GitHub Python Support License


runic ships two tools:

  • runic.orm — a lightweight, graph-optimized ORM that maps Python classes to graph nodes and edges. Supports FalkorDB, ArcadeDB, Neo4j, Memgraph, Apache AGE (PostgreSQL), and any Bolt-compatible database via a pluggable driver layer.

  • runic.migrate — an Alembic-style migration engine that tracks index and constraint changes as versioned, replayable scripts.

from runic.orm import Field, Node, Repository, Session, create_driver

class Person(Node, labels=["Person"]):
    id: str = Field()
    name: str = Field()
    email: str = Field(index=True, unique=True)

with Session(driver) as session:
    session.add(Person(id="alice", name="Alice", email="alice@example.com"))
    session.commit()

    repo = Repository(session, Person)
    print(repo.count())   # 1

ORM

ORM quickstart

Define your first node, open a session, and persist it in under a minute.

Quickstart
Core concepts

Node, Edge, Field, object states, dirty tracking, identity map.

Core Concepts
Relationships

Lazy/eager loading, polymorphic hierarchies, edge properties.

Relationships
Session & Unit of Work

add · delete · get · flush · commit · rollback · expire.

Session & Unit of Work
Query builder

Fluent filter, traversal, aggregation, fulltext and vector KNN API.

Query Builder
Supported drivers

FalkorDB, ArcadeDB, and generic Bolt — feature matrix and limitations.

Supported Drivers
ORM API reference

Full autodoc reference for every public class and function.

ORM API Reference

Migration

Migration quickstart

Install runic, run runic init, write your first migration, and apply it — all in one page.

Quickstart
CLI reference

Every command, option, and flag documented with examples.

CLI Reference
Operations reference

Full list of op.* calls available inside migration scripts.

Operations Reference
Schema management

IndexManager and SchemaManager — declare, validate, and sync indexes.

Schema management
Migration API reference

runic.migrate — programmatic migration engine API.

Migration API Reference