Skip to content

mnemosineSchema-less SQLite for Python

Dynamic attributes, interconnected files, and vector search with zero migrations.

Welcome to mnemosine ​

mnemosine is a schema-less storage library built on top of SQLite designed for applications that outgrow simple document stores or flat relational tables. It provides a unified data layer combining:

  1. Document storage β€” with JSON-backed dynamic attributes and instant indexing.
  2. File management β€” with content-addressed deduplication on disk.
  3. Graph database capabilities β€” with typed links and recursive graph traversals.
  4. Vector embeddings β€” with fast similarity search via sqlite-vec (and automatic fallback).

Why mnemosine? ​

ChallengeTraditional Approachmnemosine Solution
Evolving FieldsAlter tables / run migration scriptsStore in JSON metadata + index with index_attribute()
Large FilesHeavy BLOBs bloat the databaseOn-disk SHA-256 deduplicated blob store, metadata in DB
Complex RelationsForeign keys & complex join tablesTyped Link edges with metadata and recursive graph queries
AI & Vector SearchSeparate vector DB (Pinecone, Chroma, etc.)Embedded sqlite-vec with zero external service dependencies

Quick Example ​

python
from mnemosine import Storage

# 1. Open the storage engine
with Storage("project.db", blob_root="data/blobs") as db:
    # 2. Create a dynamic schema-less document
    doc = db.node(kind="doc", path="notes/kickoff")
    doc["title"] = "Project Plan"
    doc["tags"] = ["sqlite", "storage", "ai"]
    doc.content = "We need a resilient, hybrid storage layer."
    doc.save()

    # 3. Store a binary file (deduplicated by SHA-256 hash)
    pdf = db.file("report.pdf", mime="application/pdf")
    pdf.write(b"%PDF-1.4 sample content...")

    # 4. Link document and file with typed metadata
    doc.link(pdf, link_type="attachment", metadata={"label": "v1.0"})

    # 5. Index dynamic JSON fields on the fly
    db.index_attribute("title", as_type="TEXT")

    # 6. Graph traversal
    for neighbor in doc.neighbors(direction="outgoing"):
        print(f"Connected to: {neighbor['node'].path} via {neighbor['link'].link_type}")

Next Steps ​

Released under the MIT License.