Reputation: 53
I'm using Chrome as browser interface in Windows10 to load a CSV file in Neo4j 3.2.1, but the command
LOAD CSV FROM "file:///C:/dir/file.csv" AS row
returns the error
Neo.ClientError.Statement.SyntaxError
Query cannot conclude with LOAD CSV (must be RETURN or an update clause)
Any help to understand what is wrong?
Upvotes: 4
Views: 7123
Reputation: 71
In addition to above you may also return the whole row, this is for viewing only:
LOAD CSV FROM "file:///C:/dir/file.csv" AS row RETURN row
Also you may want to limit the number of rows read and displayed like 'limit 5' This syntax is used to do a quick view of your data how it looks etc.
Upvotes: 0
Reputation: 41676
What Dave said:
You need to follow up the LOAD CSV part with a CREATE or MERGE to actually create the data or if you want to see what you are doing first you could also RETURN it. LOAD CSV just loads the data from the file into memory.
LOAD CSV FROM "file:///C:/dir/file.csv" AS row
RETURN row[0];
Better
LOAD CSV WITH HEADERS FROM "file:///C:/dir/file.csv" AS row
RETURN row.columName;
To create data:
LOAD CSV WITH HEADERS FROM "file:///C:/dir/file.csv" AS row
CREATE (n:Label {attributeName: row.columName});
Here is the doc ref... http://neo4j.com/docs/developer-manual/current/cypher/clauses/load-csv/#load-csv-import-data-from-a-csv-file
– Dave Bennett
Upvotes: 6