runic-ogm

Model, relate, and query property-graph databases in Python with a SQLModel-style OGM.

Updated Jun 13, 2026
One-click install
npx skills add https://github.com/jenreh/project-kit-template --skill runic-ogm-jenreh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: runic-ogm
Source: https://github.com/jenreh/project-kit-template/tree/main/.agents/agent-skills/skills/runic-ogm
Command: npx skills add https://github.com/jenreh/project-kit-template --skill runic-ogm-jenreh

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing raw Cypher for every graph operation is error-prone and repetitive. This Skill guides you through runic.ogm, a typed Python OGM that lets you declare graph nodes and edges as classes and perform CRUD, relationship management, and traversals through a Session without hand-writing Cypher. ## Core Features & Use Cases - Model Mapping: Declare Node and Edge classes with typed Fields, primary keys, indexes, enums, datetimes, and FalkorDB-native types like Vector and GeoLocation. - Relations & Traversal: Define relationships with Relation(), mutate them idempotently via relate()/unrelate(), and run multi-hop traversals, aggregations, and fulltext/vector search through a fluent query builder. - Multi-Backend Sessions: Run the same model and query code against FalkorDB, Neo4j, Memgraph, ArcadeDB, or Apache AGE via a pluggable driver layer, with sync and async sessions. - Use Case: You are building a blog backend on FalkorDB. Define User and Article nodes, connect them with an AUTHORED edge carrying timestamps, then query an author's articles with eager fetching in a single query. ## Quick Start Ask the AI to define runic.ogm Node and Edge models for your domain and show a Session snippet that creates, relates, and queries the entities.

Frequently Asked Questions about runic-ogm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define graph models with runic.ogm in Python?

Subclass Node with a labels list and declare typed fields using bare annotations or Field() for options like primary_key, unique, and index. Edge property models subclass Edge with a type string. Constructors are keyword-only, and datetime and Enum fields get converters automatically.

How do I create and read relationships with edge properties in runic.ogm?

Declare a Relation with relationship, direction, target, and an edge_model, then call session.relate(source, field, target, edge=EdgeInstance) which uses MERGE semantics and updates properties in place. Read edge properties via a traversal with edge_alias and session.all_with_edges().

Does runic.ogm support Neo4j and other graph databases besides FalkorDB?

Yes, runic.ogm runs on FalkorDB, Neo4j, Memgraph, ArcadeDB, and Apache AGE through a pluggable driver layer created with create_driver. Models and queries stay unchanged, but Vector, GeoLocation, and interned types are FalkorDB-only, and search features vary by backend.

Why does accessing a relationship raise LazyLoadError in async runic.ogm code?

AsyncSession has no lazy loading, so touching an unloaded relation raises LazyLoadError. You must eager-load with await session.get(Cls, pk, fetch=[...]) or use a traversal query, and await coroutine methods like commit, relate, and scalars.

How do I avoid N+1 queries when loading relationships in runic.ogm?

Use fetch=[...] on session.get() to eager-load one entity's relations in a single query. For collections of parents, prefer one traversal query with all_with_edges() over looping with lazy access, which fires one query per entity.

When should I use raw Cypher instead of the runic.ogm query builder?

Drop to session.execute() or Repository.cypher() only for what the builder cannot express, such as edge-heavy reads, set operations, or bulk writes. Always parameterize values with $name placeholders rather than string formatting.