How to load lists of lists as string in neo4j using py2neo

427 views Asked by At

I have sample param_list-

param_list = [{
    "labels" : ["test"],
    "properties" : {"some_list" : "[['sample', 'testing']]"}
}]

and have cypher templates-

cypher_template = """UNWIND $batch as row
CALL apoc.create.node(row.labels, row.properties) yield node
RETURN count(*)"""
result = graph.run(cypher_template, {"batch" : cypher_list})

for i in result:
    print (i)

when i run the cypher statement i get the following error:

py2neo.database.ClientError: ProcedureCallFailed: Failed to invoke procedure `apoc.create.node`: Caused by: java.lang.IllegalArgumentException: [[Ljava.util.ArrayList;@125e2edb:[Ljava.util.ArrayList;] is not a supported property value

Even though i have values of properties as string type, i still get this error saying lists of lists is not supported.

py2neo == 4.3.0 neo4j == 4.0.0

1

There are 1 answers

0
cybersam On

Neo4j does not support a property value that is a list of lists.

Try changing [['sample', 'testing']] to ['sample', 'testing'].