Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-19-2021 04:20 AM
I'm trying to put a Python dictionary inside of nodes, because I recieve data as a dictionary in Python and need to save it in Neo4j.
My query looks like this: "create (a {name:"node", text: "", values: {color: "red", size: "7 m"}}) "
and it gives me this error: "Neo.ClientError.Statement.TypeError
Property values can only be of primitive types or arrays thereof. Encountered: Map{color -> String("red"), size -> String("7 m")}."
I don't understand this because in the manual section Neo4j Cypher Manual / Syntax / Maps dictionaries get referred to as maps and are used just like i do in the above query.
How to solve this error?
Solved! Go to Solution.
07-19-2021 04:25 AM
Hello @m.h98
You cannot store a map
as a property but you can use a map to set several properties. I don't know if it's clear? In your case, you are doing both so you can solve your issue by removing the depth from your map:
CREATE (a {name:"node", text: "", color: "red", size: "7 m"})
The only composite object that you can store is a list of homogeneous type such as a list of integers.
Regards,
Cobra
07-19-2021 04:25 AM
Hello @m.h98
You cannot store a map
as a property but you can use a map to set several properties. I don't know if it's clear? In your case, you are doing both so you can solve your issue by removing the depth from your map:
CREATE (a {name:"node", text: "", color: "red", size: "7 m"})
The only composite object that you can store is a list of homogeneous type such as a list of integers.
Regards,
Cobra
All the sessions of the conference are now available online