Computational Thinking + Doing

NoSQL Graph Databases

Managing graph relationships of movies and actors—using Neo4j, Amazon Neptune, Azure CosmosDB, and GCP JanusGraph/Cloud Bigtable.

Graph databases have a rich history dating back to the 1960s. The concept gained prominence in the 2000s with the emergence of social networks and the need to model complex relationships. Today, graph databases remain relevant due to their ability to handle intricate data structures and relationships. They excel in use cases like social networks, recommendation engines, fraud detection, and knowledge graphs. By representing data as nodes and edges, graph databases efficiently query and traverse interconnected data, making them ideal for applications where relationships are central to data analysis and insights.

Let’s see this flavor of NoSQL database in action using Neo4j.

Getting Started

If you are interested in reproducing this work, here are the versions of Python and Python packages. Additionally, since Python is the de facto language that glues together data engineering and cloud engineering, I won’t show examples in Julia or R. Finally, my coding style here is verbose, in order to trace back where functions/methods and variables are originating from, and make this a learning experience for everyone—including me.

import platform
import sys
print(sys.version)
3.11.4 (v3.11.4:d2340ef257, Jun  6 2023, 19:15:51) [Clang 13.0.0 (clang-1300.0.29.30)]
!pip install neo4j==5.11.0
!pip install py2neo==2021.2.3

Let’s verify the database connectivity before proceeding withh performing queries.

from neo4j import GraphDatabase

driver = GraphDatabase.driver(uri, auth=(username, password))
session = driver.session()

# Confirm connection
session
<neo4j._sync.work.session.Session object at 0x13801a590>
session.close()
driver.close()

References

  • Barrasa, J. & Webber, J. (2023). Building Knowledge Graphcs: A Practioner’s Guide. O’Reilly Media
  • Lemahieu, W., Vanden Broucke, S., & Baesens, B. (2018). Principles of Database Management: The Practical Guide to Storing, Managing and Analyzing Big and Small Data. Cambridge University Press. https://doi.org/10.1017/9781316888773
  • Robinson, I., Webber, J. & Eifrem, E. (2015). Graph Databases (2nd ed.). O’Reilly Media.
Applied Computing