Create neo4j graph database from python using html forms

1.2k views Asked by At

Hi i'm very new to neo4j i need to know how to create nodes and properties of graph using html forms by using py2neo and neo4j and how to add auto id's to the nodes

from flask import Flask,render_template,request,url_for,json,jsonify
from py2neo import neo4j,Graph,Node,Relationship,cypher
from neo4jrestclient.client import GraphDatabase


app = Flask(__name__)
gdb = GraphDatabase("http://neo4j:duke@localhost:7474/db/data")
graph=Graph("http://neo4j:duke@localhost:7474/db/data")
@app.route('/')
def index():
    results = graph.cypher.execute("MATCH (n:Person) RETURN n")
'''print "gyktdjxdhgfcvkjbljkfr",result'''
    return results.json
@app.route('/hello')
def create():
    return "f"


if __name__ == '__main__':
app.run()
1

There are 1 answers

0
Michael Hunger On

Check out this blog post by Nicole for some insight:

http://neo4j.com/blog/building-python-web-application-using-flask-neo4j/

code is on github:

https://github.com/nicolewhite/neo4j-flask

You don't need auto-incrementing id's like in a relational database. Just use the person's login for that and use MERGE

See. http://neo4j.com/developer/cypher