使用环境 ubuntu16.04
python2.7
初学试用…
import psycopg2
conn = psycopg2.connect("dbname=agens_test host=127.0.0.1 user=lsk")
cur = conn.cursor()
cur.execute("DROP GRAPH IF EXIST agans_test CASCADE")
cur.execute("CREATE GRAPH agens_test")
cur.execute("SET graph_path = agens_test")
cur.execute("CREATE (:A {name: 'John', from: 'USA', age: 17})")
cur.execute("CREATE (:B {name: 'Daniel', from: 'Korea', age: 20})")
cur.execute("MATCH (p:A {name: 'John'}),(k:B{name: 'Daniel'}) CREATE (p)-[:knows]->(k)")
conn.commit()
NOTES:
暂时这么多。