Using LOAD CSV via node-neo4j

23 views
Skip to first unread message

Matthew Hodges

unread,
Sep 18, 2014, 12:32:42 PM9/18/14
to node-...@googlegroups.com
Hi all,

I'm trying to use LOAD CSV via node-neo4j, doing something like this:

var query = "USING PERIODIC COMMIT 1000 LOAD CSV FROM 'file:\Users\applications\neo\csv.dat' AS line ";
      query += "MATCH (s:schema {name:'Unit'}) ";
      query += "MERGE (u:unit {id:line[0], tag:line[1], name:line[2], type:line[3]} ) ";
      query += "MERGE (u)-[:schema]-(s) RETURN u.id";

var params = {};

 neodb.query(query, params, function(err,qres) {
    if( err ){ return qdfr.reject(err); }
    else { 
              qdfr.resolve('ok'); 
            }
  });

I can cut and paste the query into neo4j-shell and it runs, but when I run it via my node utility, I get:

    query failed Error: Parameters must be a JSON map

Any idea why this breaks?

Thanks!
Matt Hodges

Aseem Kishore

unread,
Sep 22, 2014, 1:29:24 AM9/22/14
to Matthew Hodges, Node-Neo4j Discussion
Weird, Matt! No, I don't know why that would fail but the shell doesn't.

As a sanity check, can you run:

console.log('query:\n' + query);
console.log('params:\n' + JSON.stringify(params, null, 4);

And paste the output?

Aseem


Aseem Kishore

unread,
Sep 22, 2014, 1:29:51 AM9/22/14
to Matthew Hodges, Node-Neo4j Discussion
Actually, this would be even better:

console.log(JSON.stringify({query: query, params: params}, null, 4))
Reply all
Reply to author
Forward
0 new messages