I'm embarking on a self exploratory project regarding Neo4j database on the Panama Papers by ICIJ.
Aim: I would like to run python packages that does network analysis such as graph-tool, networkx on the database that is found on Neo4j.
Hence these are the steps that I took:
- Load Neo4j-driver, which I did load
- Connect to the Neo-4j sandbox through pycharm
This is the code:
#
from neo4j.v1 import GraphDatabase, basic_auth
driver = GraphDatabase.driver(
"bolt://34.239.248.240:33621",
auth=basic_auth("neo4j", "fares-documentation-reproductions"))
session = driver.session()
# What are the Entities in Panama Papers?
cypher_query = '''
MATCH (e:Entity)
RETURN e.name AS name LIMIT $limit
'''
results = session.run(cypher_query,
parameters={"limit": 10})
for record in results:
print(record['name'])
#
This was the error message shown:
neo4j.exceptions.ServiceUnavailable: Cannot acquire connection to Address(host='34.239.248.240', port=33621)
I've obtained the bolt/port/host from the sandbox website: https://neo4j.com/sandbox-v2/
Also, I tried to check if the neo4j-driver has been installed correctly, and I ran the testdriver code:
#
from neo4j.v1 import GraphDatabase
uri = "bolt://localhost:7474"
driver = GraphDatabase.driver(uri, auth=("neo4j", "user"))
def print_friends_of(name):
with driver.session() as session:
with session.begin_transaction() as tx:
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) "
"WHERE a.name = {name} "
"RETURN f.name", name=name):
print(record["f.name"])
print_friends_of("Alice")
#
In which this error code was shown:
neo4j.exceptions.SecurityError: Failed to establish secure connection to '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:749)'
Could you advise?
I managed to solve this problem by downloading the graph db database directly into my local server. The bolt port is 7474.