LoginSignup
1
0

More than 3 years have passed since last update.

neo4jでsandbox その16

Posted at

概要

neo4jでsandboxやってみた。
pythonでneo4j sandboxを叩いて、gistのデータを投入したのを取得してみた。

nodeを取得。


from neo4j import GraphDatabase, basic_auth

driver = GraphDatabase.driver("bolt://18.233.67.98:32829", auth=basic_auth("neo4j", "convenience-patient-function"))
session = driver.session()
cypher_query = '''
MATCH (n)
RETURN n.id, n.tosi, n.tiku, n.sex, n.date
'''
results = session.run(cypher_query, parameters = {})
print("id tosi tiku sex date")
for r in results:
    print ("%s,%s,%s,%s" % (r["n.id"], r["n.tosi"], r["n.tiku"], r["n.date"]))




linkを取得。


from neo4j import GraphDatabase, basic_auth

driver = GraphDatabase.driver("bolt://18.233.67.98:32829", auth=basic_auth("neo4j", "convenience-patient-function"))
session = driver.session()
cypher_query = '''
MATCH (n)-[]-(m)
RETURN n.id, m.id
'''
results = session.run(cypher_query, parameters = {})
print("n m")
for r in results:
    print ("%s,%s" % (r["n.id"], r["m.id"]))


以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0