py2neo

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

此生再无相见时 提交于 2019-12-05 00:42:45
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 happens when I use a Cypher transaction. This did not happen with the same query and py2neo 1.6.4. Can I increase the time py2neo waits for a response? I didn't find anything in the docs. Update I found a hard coded socket_timeout in py2neo.packages.httpstream.http . Setting it to a higher value avoids the SocketError: from py2neo.packages

Choices validation in WTForms does not update when database does

自闭症网瘾萝莉.ら 提交于 2019-12-04 08:28:30
I understand the SelectField method in WTForms takes can argument choices which has the form... choices=[("value1", "display of value 1"), ("value2", "display of value 2")] I need to populate my choices based on a call to the database. I'm using neo4j as my backend, so I can't use modelforms or the other built-in solutions for populating data in a form. def get_list_of_things(): query = 'start n = node:things("*:*") return ID(n), n.display_name;' t = cypher.execute(cdb, query)[0] for x in t: x[0] = str(x[0]) x[1] = str(x[1]) things = list(tuple(x) for x in t) return things class SelectAThing

Neo4j create nodes and relationships from pandas dataframe with py2neo

二次信任 提交于 2019-12-03 08:21:51
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 a.name 0 1964 Keanu Reeves 1 1967 Carrie-Anne Moss 2 1961 Laurence Fishburne 3 1960 Hugo Weaving Now I am trying to create (or better MERGE) a set of nodes and relationships from a pandas dataframe into a Neo4j database with py2neo. Imagine I have a dataframe like: LABEL1 LABEL2 p1 n1 p2 n1 p3 n2 p4 n2 where Labels are column header and properties as values. I

Python py2neo SocketError: Connection Refused

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to follow along to this neo4j tutorial and I'm having a problem connecting to the API. Here's my traceback: >>> graph.delete_all() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/site-packages/py2neo/core.py", line 748, in delete_all statement = StartOrMatch(self).relationship("r", "*").string + "DELETE r" File "/usr/local/lib/python2.7/site-packages/py2neo/cypher/util.py", line 45, in string if self.graph.supports_start_clause: File "/usr/local/lib/python2.7/site-packages

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

半城伤御伤魂 提交于 2019-11-30 07:09:31
问题 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 pairs of nodes with relationships between them takes a number of seconds, running on localhost. What is the best approach to significantly improve performance whilst staying with Python? Would using bulbflow and Gremlin be a way of constructing a

Neo4j how to handle special characters like ” \\ in Cypher statements

ぃ、小莉子 提交于 2019-11-29 16:47:24
I am using py2neo to load JSON data into Neo4j as chyper statements. My problem is that sometimes there are signs as “ ‘ \ etc in the strings I want to import as properties to Nodes: MERGE (p:Node {name:’This sign ‘ gives error’}) If I change to: MERGE (p:Node {name:” This sign ‘ gives error”}) It will work for the statement over but it will fail when a “ is in an input string. Is there a way to say that all (or almost all) special character is allowed inside the string? Sorry if this is a stupid question :) If you want to include double quotes, you can wrap in single quotes: CREATE (n:Node

Neo4j how to handle special characters like ” \ in Cypher statements

寵の児 提交于 2019-11-28 10:24:13
问题 I am using py2neo to load JSON data into Neo4j as chyper statements. My problem is that sometimes there are signs as “ ‘ \ etc in the strings I want to import as properties to Nodes: MERGE (p:Node {name:’This sign ‘ gives error’}) If I change to: MERGE (p:Node {name:” This sign ‘ gives error”}) It will work for the statement over but it will fail when a “ is in an input string. Is there a way to say that all (or almost all) special character is allowed inside the string? Sorry if this is a