-
Book Overview & Buying
-
Table Of Contents
Building web applications with Python and Neo4j
By :
Relational databases have been one of the most widely used and most common forms of software systems for the storage of data since the 1970s. They are highly structured and store data in the form of tables, that is, with rows and columns. Structuring and storing data in the form of rows and columns has its own advantages; for example, it is easier to understand and locate data, reduce data redundancy by applying normalization, maintain data integrity, and much more.
But is this the best way to store any kind of data?
Let's consider an example of social networking:
Mike, John, and Claudia are friends. Claudia is married to Wilson. Mike and Wilson work for the same company.
Here is one of the possible ways to structure this data in a relational database:

Complex, isn't it? And it can be more complex!
We should remember that relationships are evolving, and will evolve over a period of time. There could be new relationships, or there could be changes to existing relationships.
We can design a better structure but in any case, wouldn't that be forcibly fitting the model into a structure?
RDBMS is good for use cases where the relationship between entities is more or less static and does not change over a period of time. Moreover, the focus of RDBMS is more on the entities and less on the relationships between them.
There could be many more examples where RDBMS may not be the right choice:
Consider another way of modelling the same data:

Simple, isn't it?
Welcome to the world of Neo4j—a graph database.
Although there is no single definition of graphs, here is the simplest one (http://en.wikipedia.org/wiki/Graph_(abstract_data_type)), which helps us to understand the theory of graphs:
A graph data structure consists of a finite (and possibly mutable) set of nodes or vertices, together with a set of ordered pairs of these nodes (or, in some cases, a set of unordered pairs). These pairs are known as edges or arcs. As in mathematics, an edge (x,y) is said to point or go from x to y. The nodes may be part of the graph structure, or may be external entities represented by integer indices or references.
Neo4j, as an open source graph database, is part of the NoSQL family, and provides a flexible data structure, where the focus is on the relationships between the entities rather than the entities themselves.
Its first version (1.0) was released in February 2010, and since then, it has never stopped. It is amazing to see the pace at which Neo4J has evolved over the years. At the time of writing this book, the stable version was 2.2.RC01, which was released in March 2015.
If you are reading this book, then you probably already have sufficient knowledge about graph databases and Python. You will appreciate their contribution to the complex world of relationships.
Let's move forward and jump into the nitty-gritty of developing web applications with Python and Neo4j.
In the subsequent chapters, we will cover the various aspects dealing with data modelling, programming, and data analysis by means of application development with Python and Neo4j. We will cover the concepts of working with py2neo, Django, flask, and many more.
Change the font size
Change margin width
Change background colour