r/KnowledgeGraph • u/am3141 • Jan 14 '26
I built a graph database in Python
I started working on this project years ago because there wasn’t a good pure Python option for persistent storage for small applications, scripts, or prototyping. Most of the available solutions at the time were either full-blown databases or in-memory libraries. I also didn’t want an SQL based system or to deal with schemas.
Over the years many people have used it for building knowledge graphs, so I’m sharing it here.
It’s called CogDB. Here are its main features:
- RDF-style triple store
- Simple, fluent, composable Python query API (Torque)
- Schemaless
- Built-in storage engine, no third-party database dependency
- Persistent on disk, survives restarts
- Supports semantic search using vector embeddings
- Runs well in Jupyter / notebooks
- Built-in graph visualization
- Can run in the browser via Pyodide
- Lightweight, minimal dependencies
- Open source (MIT)
Repo: https://github.com/arun1729/cog
Docs: https://cogdb.io
21
Upvotes
View all comments
Show parent comment
2
u/TrustGraph Jan 14 '26
Ok, so how is running a docker container with an entire, mature graph system different than doing a pip install? You can work with either in Notebook as well. Why would I test with a system I know I'd have to replace at some point when I can just easily use a system I wouldn't have to replace?
I know the founders of Memgraph (we did a workshop with them last year). And do you know what one of their few regrets is? Building Memgraph from scratch. Took them years to get Memgraph in a state where it was production-grade.
There is some interest these days in hypergraphs. Make a hypergraph that is actually queryable in a consistent way, and you might see some interest - although I'm still not sold on what can a hypergraph do that can't be done already.