Search code examples
pythonpython-3.xpy2neo

Insert Property Value using Py2neo


I have one label say User,and one property say Email.I am trying to insert one property value based on user input like "abcd@gmail.com" . My code is below

db=Graph("bolt://localhost:1234", user="", password="")
db.evaluate('''Create (u:User) WHERE u.Email=$para1 RETURN u''',
                                         parameters={'para1': arg}))

I am tried also

db.create(Node("User", "Email").__setitem__("Email", arg))

However both is not working.


Solution

  • I have solved my problem.Posting the answer so it may help others.

    self.db.evaluate('''Create (u:User) SET u.Email=$para1 RETURN u''',
                                             parameters={'para1': arg})