Skip to main content

CypherDB is a lightweight, zero-dependency, embedded graph database written entirely in Go. Think of it as SQLite for Graph Databases

Project description

CypherDB

The Minimalist Embedded Graph Database in Pure Go with Python bindings

PyPI version Go Reference Go Version License: MIT Go Report Card


📖 Project Overview

CypherDB (formerly GoGraph) is a lightweight, zero-dependency, embedded graph database written entirely in Go. Think of it as "SQLite for Graph Databases".

It allows Go and Python developers to execute Cypher queries (the standard graph query language) and manage local graph data—nodes, relationships, and properties—without the overhead of external heavy database services like Neo4j.

⚡ Quick Start

1. Install Python Package

pip install cypherdb

Basic Example:

import cypherdb

# Create database
db = cypherdb.Database("my_graph.db")

# Use transaction with context manager
with db.transaction() as tx:
    node_id = tx.create_node("Person", {"name": "Alice"})
    print(f"Created node: {node_id}")
    # Auto-commit

# Manual transaction
tx = db.transaction()
try:
    tx.create_node("Person", {"name": "Bob"})
    tx.commit()
except:
    tx.rollback()

2. Install CLI (Go)

The fastest way to explore CypherDB is via the CLI.

macOS / Linux (Homebrew):

brew tap dotnetage/gograph
brew install gograph

Run TUI (Interactive Shell):

# Simply run without arguments to open default.db in interactive mode
gograph

✨ Key Features

  • 🚀 Pure Go: No CGO, seamless cross-platform support.
  • 🐍 Python Bindings: Easy integration with Python applications.
  • 📦 Embedded: Zero-config, single-directory storage (Pebble DB).
  • 🔍 Cypher Support: Native MATCH, CREATE, SET, DELETE.
  • 🛡️ ACID: MVCC, thread-safety, and WAL recovery.
  • 🛠️ TUI Included: Interactive shell with auto-completion and ASCII tables.

📝 CRUD Examples

Create

import cypherdb

db = cypherdb.Database("my_graph.db")

with db.transaction() as tx:
    # Create nodes
    alice = tx.create_node("Person", {"name": "Alice", "age": 30})
    bob = tx.create_node("Person", {"name": "Bob"})
    charlie = tx.create_node("Person", {"name": "Charlie"})
    
    # Create relationship
    tx.create_relationship(alice, bob, "KNOWS", {"since": 2020})
    tx.create_relationship(bob, charlie, "KNOWS", {"since": 2021})

Read

with db.transaction() as tx:
    # Find all Person nodes
    persons = tx.query("MATCH (p:Person) RETURN p.name, p.age")
    for person in persons:
        print(f"Name: {person['p.name']}, Age: {person.get('p.age', 'N/A')}")
    
    # Find relationships
    friends = tx.query("""
        MATCH (a:Person)-[r:KNOWS]->(b:Person) 
        RETURN a.name, b.name, r.since
    """)
    for f in friends:
        print(f"{f['a.name']} knows {f['b.name']} since {f['r.since']}")

Update

with db.transaction() as tx:
    # Update property
    tx.exec("MATCH (p:Person {name: 'Alice'}) SET p.age = 31")
    
    # Add label
    tx.exec("MATCH (p:Person {name: 'Bob'}) SET p:Admin")

Delete

with db.transaction() as tx:
    # Delete a node
    tx.exec("MATCH (p:Person {name: 'Alice'}) DELETE p")
    
    # Delete node and all its relationships
    tx.exec("MATCH (p:Person {name: 'Bob'}) DETACH DELETE p")
    
    # Delete relationships only
    tx.exec("MATCH ()-[r:KNOWS]->() WHERE r.since < 2021 DELETE r")

💻 CLI Usage

The gograph binary provides a powerful TUI and command-line utilities.

Command Description
gograph Launch Interactive TUI (default to default.db)
gograph query <cypher> Run a read-only query
gograph exec <cypher> Run a data modification command

Example:

gograph query "MATCH (n) RETURN n"

🧩 System Compatibility

  • OS: macOS, Linux, Windows.
  • Arch: amd64, arm64.
  • Python: 3.9+

📚 Documentation

Check out the full Documentation or the Docs Folder.

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

cypherdb-0.3.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

cypherdb-0.3.0-cp314-cp314-macosx_26_0_x86_64.whl (4.7 MB view details)

Uploaded CPython 3.14macOS 26.0+ x86-64

File details

Details for the file cypherdb-0.3.0.tar.gz.

File metadata

  • Download URL: cypherdb-0.3.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for cypherdb-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e5a01988eeef5d1f87685a7a6e0fd80a2ae8e328c23c9b6aa9d0be2265a8d673
MD5 42f0b72eca069768de60112701712a90
BLAKE2b-256 79a99f39bfd3a3b680bcac52ee2511095acf9b91c8e77c2b215a54fb4b95ea23

See more details on using hashes here.

File details

Details for the file cypherdb-0.3.0-cp314-cp314-macosx_26_0_x86_64.whl.

File metadata

File hashes

Hashes for cypherdb-0.3.0-cp314-cp314-macosx_26_0_x86_64.whl
Algorithm Hash digest
SHA256 7b211b492eb18554a2d1b4c1b19fa0c92d97546c852f83d411dc170a40f27004
MD5 961b77eb94add380d3a9301d15469b29
BLAKE2b-256 086e79438b76927d597c52bbb3b01b7960372a230be168a04a3fdc9114b2872c

See more details on using hashes here.

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