Skip to content

Commit

Permalink
WIP: Trying to connect to Neo4j
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBakerEffendi committed Mar 4, 2020
1 parent 2ab6caf commit e4292b3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
USER = "neo4j"
PASSWORD = "bitnami"
URI = "bolt://localhost:7687"
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '2'
services:
neo4j:
image: 'bitnami/neo4j:4'
ports:
- '7474:7474'
- '7473:7473'
- '7687:7687'
volumes:
- 'neo4j_data:/bitnami'
networks:
- neo4j-network

volumes:
neo4j_data:
driver: local

networks:
neo4j-network:
driver: bridge
13 changes: 13 additions & 0 deletions neo4j_yelp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from neo4j import GraphDatabase

uri = "bolt://0.0.0.0:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "bitnami"))

def print_friends_of(tx, name):
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) "
"WHERE a.name = {name} "
"RETURN f.name", name=name):
print(record["f.name"])

with driver.session() as session:
session.read_transaction(print_friends_of, "Alice")
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
neo4j==1.7.6
neobolt==1.7.16
neotime==1.7.4

0 comments on commit e4292b3

Please sign in to comment.