Python 10. Neo4j Graph Database & Py2neo

The community edition download on the Neo4j  website is here.  After downloading the particular version you want in ZIP format it takes you to a page that offers a free book and the instructions for installing.

For basic overview and setting up Neo4j community edition ( older version from an EXE ) I watched the following video series:

I found this video useful. It is created by the same person who did the beginners MongoDB tutorial, he gives you all the basic code to make an initial start.

This one is quite advanced but good in showing where to get a good dataset to practice. The arrows examples I think were just a  diagrammatic example

So for the install, I located my instance in C:\neo4j\bin. I used the latest zip file and moved it to that location.  I also had my database there under  C:\neo4j\data\databases\graph.db.

I started the COMMAND prompt in Administration mode and moved to the C:\neo4j\bin and then ran the :

‘> neo4j console [enter]

That started the server instance of Neo4j on my computer, then I went to my web browser and put in:


That brought up my instance for working in neo4j.

So, I put in some nodes for Site, Block, Unit & Rooms. Also made one way connectors using CONTAINS as a relationship from     Site to Block, Block to Unit, Unit to Rooms.

I am not sure that there is much point in putting in a reverse relationship of “CONTAINED IN”. \

My next challenge is to upload a lot of data into the Database. I have some CSV data in SPM format that I may try and upload. I’m not sure that this is the right data set to use as its pretty hierarchical.

Python & Neo4j

Nicole White, Chief Data Scientist, Neo Technology:Learn how to use Python to collect data from Twitter’s API, Neo4j to easily and reliably store this highly-connected data, and Python again for quick analysis and visualization. Follow along with these resources –


I had to alter the code in PyCharm to give Graph some connection details to Neo4j but apart from that the code ran great and created the nodes in Neo4j on my local server.

I also moved the existing  graph.db from C:\neo4j\data\databases\graph.db to C:\neo4j\OLDDB\graph.db as I didn’t want to delete the work I’d already done.

I still have not figured out how to create a completelty new DB. But that can be for later.

So I now have a connection between Python and Neo4j. So can write and create nodes and relationships in neo4j from python and also do some graphing in Python now I have the connection.



There is this video below by the same person in the video above. I have not tested any of the things she is demonstrating yet.

End thoughts

Now I have Neo4j up and running and a python connection I will think about developing this to see if I can use it in the property asset environment. I need to do a bit of searching on the web to see if there are any examples.

Add a Comment