Search code examples
neo4jneomodel

How to add label to neo4j nodes using neomodel (batch create)


I am creating nodes using batch create method mentioned in the documentation: people = Person.create( {'name': 'Tim', 'age': 83}, {'name': 'Bob', 'age': 23}, {'name': 'Jill', 'age': 34}, ) Nodes gets created successfully but without labels

when I write cypher query MATCH (p:Person) return count(p) I get 0 records as label "Person" doesn't exist. Does anyone know how to add labels to neomodel Structured Nodes


Solution

  • The "master branch" version of neomodel (the one you would get if you installed it using pip) only supports up to neo4j 1.9. Since labels are only available in neo4j 2.0+, the 1.X version of neomodel doesn't support them. There is an active development branch of neomodel that supports neo4j 2.X (https://github.com/robinedwards/neomodel/tree/feature_neo4j_2_0) but it has not been officially released and should be considered a work in progress.