FAQ Database Discussion Community


py2neo: py2neo.packages.httpstream.http.SocketError: timed out - execute, stream or Transactions?

neo4j,cypher,py2neo
First of all. I'm sorry if this is not complicity structured. I'm just not sure where to start or end, but did my best to give you as many information as possible. I work on a AWS M3.large, py2neo 2.0.4 and neo4j-community-2.1.7 I am trying to import a large dataset...

Optimizing py2neo's cypher insertion

python,neo4j,graph-databases,py2neo
I am using py2neo to import several hundred thousand nodes. I've created a defaultdict to map neighborhoods to cities. One motivation was to more efficiently import these relationships having been unsuccessful with Neo4j's load tool. Because the batch documentation suggests to avoid using it, I veered away from an implementation...

Are my Cypher statements 'overdone'

neo4j,py2neo
I am using py2neo with transactions. This means I am using the Cypher language. I am appending the textual Cypher statements to a transaction queue and submitting the contents of the queue in one shot with commit. It works fine. However, it is slow. I am getting about 100/nodes per...

how do I abort a query in py2neo?

python,neo4j,py2neo
I'm developing a web app that is basically a GUI to this Neo4j dataset we have here at my organization. The app is in Python (I'm using Flask+Tornado) and I'm using py2neo to connect to Neo4j. Things work fine, but sometimes a query will take too long to execute and...

How do I count all the other nodes related to a specific node

neo4j,cypher,py2neo
The path is representing for users' browse history. The upper path means there's one user who has browsed page A -> page B -> page C The lower path means, one user browsed page X-> page Y -> page B -> page C For example, If I want to calculate...

Py2neo Connection Refused Only with Cypher Execute

python-3.x,neo4j,py2neo
I'm running py2neo 2.0.4 on a remote Neo4j 2.1.6 database. I'm able to connect to the database with some commands, but not with all. Using the same connection uri for both instances: This works fine. test = self.graph_db.find_one('Node') This does not. test = self.graph_db.cypher.execute('MATCH (n) RETURN n LIMIT 1') Regardless...

Stop Log from Outputting in py2neo

logging,neo4j,py2neo
How can I stop py2neo from spitting out each created relationship/node, like the following: (http://localhost:7474/db/data/' ref=u'relationship/13441' start=u'node/13446' end=u'node/3' type=u'IN' properties={}>,) As encouraged by this page, when I set the below line to OFF java.util.logging.ConsoleHandler.level=OFF I silence logging when I call a function which creates the relationship/node. However, if I directly...

py2neo cypher error: KeyError: "u'cypher'

neo4j,cypher,py2neo
I'm trying to execute a cypher query with py2neo 2.0 (and Neo4j 2.1.6), but it fails with the following error: File "C:\Envs\project\lib\site-packages\py2neo\core.py", line 678, in cypher self.__cypher = CypherResource(metadata["cypher"], metadata.get("transaction")) KeyError: "u'cypher' While debugging, I found that the metadata property doesn't have a cypher entry, but I'm wondering how I...

Py2neo - Rollback to previous state

python,neo4j,py2neo
I need a way to reach a previous state of the graph (i.e undo X number of changes). Is it possible to store the data, so that later you can replace the graph by that copy? Or is it possible to export the graph to a file and then load...

Declare a unique constraint for Neo4j relationships dependent on direction (ideally with py2neo)

python,neo4j,cypher,py2neo
Is there an alternative to py2neo's create_unique method for relationships that takes direction into account? Such that uniqueness === same nodes, same label, and same direction? A solution for Py2neo would be ideal, but I wouldn't be opposed to switching to a more complete driver if there is one. EDIT:...

Can't delete neo4j nodes with a relationship using py2neo

python,neo4j,py2neo
I'm learning neo4j through the py2neo module. Modifying the example, I'm confused on why I'm getting an error here. If I want to delete all nodes of the Person type, why can I not iterate through the graph and remove the ones that match my criteria? If the relationship between...

Moving to py2neo 2.0 and streaming

py2neo
I upgraded to py2neo 2.0 and the code I used for streaming and writing results to file doesn't work any more. The error I am getting is TypeError: 'CypherResource' object is not callable. from py2neo import Graph from py2neo.packages.httpstream import http http.socket_timeout = 9999 graph = Graph() query=""" MY QUERY...

Can I have a temporary/alternative neo4j graph for testing?

python,neo4j,py2neo
I'm using Py2neo in a project. Most of the time the neo4j server runs on localhost so in order to connect to the graph I just do: g = Graph() But when I run tests I'd like connect to a different graph, preferably one I can trash without any consequencews....

How do I calculate all the relationship properties with py2neo or cypher query language

neo4j,cypher,py2neo
The model is for recording all the browse history How could I summation/average/find_max/find_min for all the pages browse to page 2 The expected answers are summation all the browsed time to page2 : 100+200+300+500 find_max browse time to page2 : 500 find_min browse time to page2 : 100 average browse...

py2neo (1.6) how to get an existing node by node property without CypherQuery

python,neo4j,py2neo
I'm using py2neo (version 1.6). I want to get an existing node by its property from the graph and then use it to create a relationship. My solution: graph = neo4j.GraphDatabaseService("http://...") query = neo4j.CypherQuery(graph,"MATCH (n:NodeType) where n.property = 'property' return n") r = query.execute() if len(r.data)==0: raise Exception("node does not...

py2neo raises ConstraintViolation Error, shell does not

python,neo4j,py2neo
A ConstraintViolation error arises when I try an import statement in py2neo, but this same error never appears when I import directly in neo4j's shell. I'm using the same exact statement in both, where in py2neo I simply use graph.cypher.execute(...). Note that I have multiple times ensured that each ID...