Neo4j and Django

Chad Shryock
2 min readFeb 1, 2018

--

For a little over a year I have been using Neo4j as my primary database for CementJob, a publication focused on high-school wrestling in Pennsylvania.

Some observations:

Pros

  • Speed. Hands-down this is by far the biggest advantage. Writing our own queries, allowed us to make a single call and receive all of the data for the page.
  • Flexibility. In wrestling, everyone does everything a little differently. When the data model was in SQL tables, we had dozens of join tables to handle special cases. Even then we still didn’t cover every situation.
  • The graph and cypher query language. Having all of our data in a graph database has allowed us to add additional features quickly and easily. The cypher query language has a low learning curve. And once we wrapped our heads around the basic concepts of a Node and Relationship, modeling the data became enjoyable.

Cons

  • No ORM. Neo4j provides a Python driver, which works well. However, we have to write / generate all of our queries.
  • Writing CRUD queries. This is probably the biggest con. The development gains from the flexibility of the model was balanced out having to write individual queries.
  • No Django Admin. This one was bittersweet. The ease of always having a way to simply and quickly edit a piece of data is in my opinion one of Django’s biggest features. For CementJob we ended up building a custom Data and Content Management System.
Sample of our graph with our many relationships.

--

--