HACKER Q&A
📣 elviejo

What is the sqlite of graph databases?


This question came back today:

What is a single file, open source, embeddable, with a query language graph database?

4 years ago there was a similar question: https://news.ycombinator.com/item?id=10991751


  👤 codykochmann Accepted Answer ✓
I wrote a python wrapper around sqlite to turn it into a graph database a while back. If you haven't heard of a triplicate store pattern, thats pretty much how you do graphdbs in sql and keep things fast. Here's a link to the project. :)

https://github.com/CodyKochmann/graphdb


👤 dgb23
Disclaimer: Not exactly what you are looking for but very close and might suit your needs or spark your interest anyways.

I've been playing around with datahike[0] a lot recently. It is a Clojure Datalog based DB like Datomic[1] and in fact mimics its API and behavior, but will by default just write to a directory (not a single file last time I checked) and (will?) support other back-ends such as PostgreSQL. Checkout the repo for more information on the differences.

These DBs are not exactly graph DBs (like for example Neo4j) but modelling and (recursively) querying graph data is very much a straight-forward use-case.

Schemas are attribute based rather than record/collection based, so you get the kind of schema flexibility you are used to from graph DBs.

Another interesting fact is that these are 'immutable' or rather value oriented by default. In simple terms: transactions are additions of facts rather than mutations.

Datalog is the primary query language which has really interesting/nice properties. It is worth checking out just for that fact. In Clojure these queries are just normal Clojure data-structures. One of the Clojure linters clj-kondo[2] even ships with static analysis for the soundness of these queries.

[0] https://github.com/replikativ/datahike

[1] https://www.datomic.com/

[2] https://github.com/borkdude/clj-kondo


👤 raizinho
After doing a ton of searching - and being extremely picky - I ended up writing a thin two way wrapper for sqlite and networkx. The only graph database that was easy to get started with that I felt comfortable using was Neo4j, and it's definitely not a sqlite equivalent.