Welcome to Runic¶
Graph schema migrations and OGM for Cypher-based graph databases.
runic ships two tools:
runic.ogm — a lightweight, graph-optimized OGM 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.ogm 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
OGM
Define your first node, open a session, and persist it in under a minute.
Declare nodes, edges, fields, and relationships — with types, indexes, and constraints.
Lazy/eager loading, polymorphic hierarchies, edge properties.
add · delete · get · flush · commit · rollback · expire.
Fluent filter, traversal, aggregation, fulltext and vector KNN API.
AsyncSession, no-lazy rules, async CRUD, repositories, and testing.
Embedded FalkorDB, pytest fixtures, isolation patterns, and gotchas.
FalkorDB, ArcadeDB, Neo4j, Memgraph, AGE — feature matrix and limits.
Full autodoc reference for every public class and function.
Migration
Install runic, run runic init, write your first migration, and
apply it — all in one page.
Three-stage workflow, Field→op table, ordering rules, and 7 annotated patterns.
Every command, option, and flag documented with examples.
Full list of op.* calls available inside migration scripts.
IndexManager and SchemaManager — declare, validate, and sync indexes.
runic.migrate — programmatic migration engine API.