Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-17-2021 05:49 AM
Hi, this is my first post, I've been picking up Neo4j a lifetime of standard DB and I am stuck at a probleme that I can't solve. I've tried going through the forum but I have yet to find a solution
I am required to dump an entire node into a file (format not important, could be csv or json) and this is my code which is a basic Match all:
def get_node(self, node_name): with self.driver.session() as session: result = session.read_transaction(self._find_and_return_node, node_name) i=0 for record in result: i+=1 print("Found record {i} : {record}".format(record=record,i=i)) data = record["end_date"] print(data) #print("Detail : {record}".format(record=record.properties, i=i)) @staticmethod def _find_and_return_node(tx, node_name): query = ( "MATCH (n:"+node_name+") RETURN n AS name" ) result = tx.run(query).data() return [record["name"] for record in result]
This works when the node is small (around 5000 elements). However, for huge nodes (100k elements ), my script fails miserably and rage quits after awhile. (no error, just a SIGKILL). Is there another way to accomplish what I set out to do? Am I missing something.
08-17-2021 07:54 PM
Hello, try apoc.periodic methods. It allows your query to be processed in batches.
Also you should try using EXPLAIN query method to understand the resources your query is utilizing and verify your debug log to verify any other errors.
08-18-2021 03:20 AM
I see, I'll try that and see, thank you
All the sessions of the conference are now available online