Questions tagged [py2neo]

Py2neo provides Python bindings for the Neo4j graph database via its REST web service interface.

Py2neo provides Python bindings for the Neo4j graph database via its REST web service interface. With more detailed information available from py2neo.org, the source code can be found on GitHub and an installable package from the Python Package Index.

The library provides both in-depth support for the Cypher query language as well as the Geoff graph data notation.

729 questions
18
votes
5 answers

Fastest way to perform bulk add/insert in Neo4j with Python?

I am finding Neo4j slow to add nodes and relationships/arcs/edges when using the REST API via py2neo for Python. I understand that this is due to each REST API call executing as a single self-contained transaction. Specifically, adding a few hundred…
wodow
  • 3,871
  • 5
  • 33
  • 45
15
votes
1 answer

py2neo 2.0: ERROR:httpstream:! SocketError: timed out

I execute a long running (5 mintues) Cypher query with py2neo 2.0: graph.cypher.run(query) or result = graph.cypher.execute(query) The query fails after ~60 sec with a Socket Error from httpstream: ERROR:httpstream:! SocketError: timed out The same…
Martin Preusse
  • 9,151
  • 12
  • 48
  • 80
12
votes
1 answer

Error connecting python to neo4j using py2neo

I wrote the following python code to neo4j using py2neo from py2neo import Graph from py2neo import neo4j,Node,Relationship sgraph = Graph() alice = Node("person",name="alice") bob = Node("person",name="bob") alice_knows_bob =…
Rohit Upadhyay
  • 129
  • 1
  • 2
  • 12
12
votes
3 answers

Is it possible to iterate through all nodes with py2neo

Is there a way to iterate through every node in a neo4j database using py2neo? My first thought was iterating through GraphDatabaseService, but that didn't work. If there isn't a way to do it with py2neo, is there another python interface that would…
beardc
  • 20,283
  • 17
  • 76
  • 94
11
votes
2 answers

Neo4j create nodes and relationships from pandas dataframe with py2neo

Getting results on a pandas dataframe from a cypher query on a Neo4j database with py2neo is really straightforward, as: >>> from pandas import DataFrame >>> DataFrame(graph.data("MATCH (a:Person) RETURN a.name, a.born LIMIT 4")) a.born …
Fabio Lamanna
  • 20,504
  • 24
  • 90
  • 122
11
votes
4 answers

Change node color based on properties - neo4j

I want to change the color of my nodes based on their properties: Say I have many "Person" nodes. And I want those who live in New York to be red and those who live in Los Angeles to be blue. How would I write that. In cypher or in py2neo?
Nicky Feller
  • 3,539
  • 9
  • 37
  • 54
10
votes
2 answers

AttributeError: 'Graph' object has no attribute 'cypher' in migration of data from Postgress to Neo4j(Graph Database)

I am working on migration of data from postgres to Graph Database manually. I have wrote script below: import psycopg2 from py2neo import authenticate, Graph authenticate("localhost:7474", "neo4j", "password") n4j_graph =…
Usman Maqbool
  • 3,351
  • 10
  • 31
  • 48
9
votes
1 answer

Neo4j return nested JSON

My Neo4j database contains family tree relationships. I would like to extract that data in a nested JSON format like so: { "firstname":"Jon", "lastname":"Smith", "parents":[ { "firstname":"Anna", "lastname":"Smith", …
Porjaz
  • 771
  • 1
  • 8
  • 28
9
votes
2 answers

Failed WriteBatch Operation with py2neo

I am trying to find a workaround to the following problem. I have seen it quasi-described in this SO question, yet not really answered. The following code fails, starting with a fresh graph: from py2neo import neo4j def add_test_nodes(): #…
SunPowered
  • 706
  • 4
  • 17
7
votes
3 answers

py2neo - updating existing node with new properties w/uniqueness constraint (merge_one)

I've been trying to figure out a way to adapt the merge_one functionality from py2neo v2 to v3. I read in a Google group that "The merge_one method no longer exists in v3 as you should be able to use merge in all cases instead." but I can't figure…
Neil Aronson
  • 99
  • 1
  • 6
7
votes
3 answers

Cannot connect to neo4j database on Docker container

I'm using two docker containers on one host machine. The first one is based on ordinary neo4j:2.3 image with some forwarded ports (7474). The second one is python:2.7-based container. Using curl I can access db from both host machine level and…
kboom
  • 2,279
  • 3
  • 28
  • 43
7
votes
1 answer

Best way to upload data using py2neo

I have experimented with ways to upload medium-size data sets using py2neo. In my case, there are about 80 K nodes and 400 K edges that need to be loaded every day. I want to share my experience, and ask the community if there is still a better way…
6
votes
0 answers

Cypher error with py2neo only when running nginx

I have a flask app that uses neo4j for some data. Everything runs fine locally when I use the python server, but when I deploy on nginx+uwsgi, I can no longer execute cypher queries in py2neo. I can't tell whether the miscommunication is at the…
Mittenchops
  • 18,633
  • 33
  • 128
  • 246
5
votes
1 answer

Slow merging of subgraph with neo4j and py2neo

I am working on a project where I need to perform many merge operations of subgraphs onto a remote graph. Some elements of the subgraph may already exist in the remote graph. I am using py2neo v3, and neo4j. I tried using the create and merge…
Anis
  • 2,984
  • 17
  • 21
5
votes
2 answers

Slow performance bulk updating relationship properties in Neo4j

I'm struggling to efficiently bulk update relationship properties in Neo4j. The objective is to update ~ 500,000 relationships (each with roughly 3 properties) which I chunk into batches of 1,000 and processing in a single Cypher statement, UNWIND…
John
  • 783
  • 6
  • 12
1
2 3
48 49