cancel
Showing results for 
Search instead for 
Did you mean: 

Create node property from python dictionary

vence_andersen1
Graph Buddy

Hie, 

I have a python dictionary, temp = {"Height":168, "Weight":112, "id":10}. I am trying to create node label "Person". Can I use the dict as the properties for the node? As "match (n:person{temp}) return n" this is throwing an error, I have connceted neo4j to python using neo4j library.

Is there a possible way to do this?

3 REPLIES 3

Cobra
Ninja
Ninja

Hello @vence_andersen1 😊

Yes, it's possible, see here.

Regards,
Cobra

Well it's not, because in python dictionary, they keys are enclosed in strings example {"key":"value"}, but neo4j doesn't accept if the propery name is enclosed inside string, it accepts only if it's {key:"value"} like this.

You should be able to pass the dictionary in the parameters of the connector otherwise you can use apoc.convert.fromJsonMap() function from APOC plugin.