Fast Batched Updates of Graph Structures with Neo4j and Cypher


(Paolodipietro58) #1

Continuing the discussion from Setting the stack size doesn't seems to work:

Andrew, I read the Michael doc and created the batch of data to pass to the query.

But I had no success.

The batch of data reflect the description of Michael:

{batch: [{row1},{row2},{row3},...10k]}
UNWIND {batch} as row
// now perform updates with the data in each "row" map
{batch: [
{ Paziente: { ID: 1, cognome: "AAAA", nome: "BBBB", nascita: "27/08/1984"} },
{ Paziente => { ID: 2, cognome: "CCCC", nome: "Federica", nascita: "18/07/1971",recapito {cellulare: "3356654272", email: ""}} }
] }
UNWIND {batch} as row

But it always returns an error, in this case

 Neo.ClientError.Statement.SyntaxError: Invalid input '{': expected <init> (line 1, column 1 (offset: 0)) "{batch: [" ^

I tried different variants, like explicit passing as param, with no success. Any idea?

I suggest to review and explain better how to define and how to use param, because the examples are too limited and it seems nor running with the 3.5.0

(Michael Hunger) #2

The batch has to be passed as parameter to your query if you run it from a client.

If you run it from the browser / cypher shell you need to set the parameters upfront.

with :param batch => [{row1},{row2},{row3},...10k]

(Paolodipietro58) #3

Yes, but I cannot load the example query I provided to set it as a parameter: not clear for me if and where is my fault

(Andrew Bowman) #4

You may want to use :help param to view the syntax here.

Keep in mind that for the browser, the setting of the parameter must be done separately from the Cypher query that uses it. You don't submit the setting of the parameter within the query.

(Paolodipietro58) #5

Yes, I know it, and finally I was able to have a long and complex set of parameters to be loaded without errors.

It's not so easy, because the browser returns only a generic 'error loading parameters: cannot parse', and I have to debug by hand each line to discover the error. A better response, with at least the line number and the offending line should be helpfull.