diff --git a/config.py b/config.py new file mode 100644 index 0000000..5644dbd --- /dev/null +++ b/config.py @@ -0,0 +1,3 @@ +USER = "neo4j" +PASSWORD = "bitnami" +URI = "bolt://localhost:7687" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..81ead46 --- /dev/null +++ b/docker-compose.yml @@ -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 \ No newline at end of file diff --git a/neo4j_yelp.py b/neo4j_yelp.py new file mode 100644 index 0000000..1e585af --- /dev/null +++ b/neo4j_yelp.py @@ -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") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3dfe2b6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +neo4j==1.7.6 +neobolt==1.7.16 +neotime==1.7.4 \ No newline at end of file