Now let's try using Neo4j with Python. If it wasn't installed before, make sure to install the (officially supported) Neo4j Python driver:
sudo pip install neo4j-driver
Now we will write a simple Python script (named neo4jHelloWorld.py) to accomplish three tasks:
- Create a node representing the Python language entity
- Create an ACCESSED_FROM edge connecting Python with the Welcome message
- Query the Welcome message via the ACCESSED_FROM Python edge
We will start with our imports and our system arguments to handle hostname, username, and password from the command line:
from neo4j.v1 import GraphDatabase, basic_auth import sys hostname=sys.argv[1] username=sys.argv[2] password=sys.argv[3]
Next, we will connect to our local Neo4j instance ...