py2neo: may function "create_nodes" return ids?

12 views
Skip to first unread message

Eugeny Kozhanov

unread,
Apr 27, 2012, 9:49:43 AM4/27/12
to ne...@googlegroups.com
Hi to all!
I want to use py2neo for create nodes (via function
create_nodes(*props)). May this function return ids of created nodes?

Nigel Small

unread,
Apr 27, 2012, 9:55:13 AM4/27/12
to ne...@googlegroups.com
Hi Eugeny

This function returns Node objects, each of which has an "id" property. If you're running py2neo 1.2 (released earlier this week) then you'll want to use something like:

nodes = graph_db.create_nodes({"name":"Alice"}, {"name":"Bob"})
node_ids = [node.id for node in nodes]

Nige

Eugeny Kozhanov

unread,
Apr 27, 2012, 10:04:59 AM4/27/12
to ne...@googlegroups.com
Thanks a lot!

пятница, 27 апреля 2012 г., 17:55:13 UTC+4 пользователь Nigel Small написал:
Reply all
Reply to author
Forward
0 new messages