cancel
Showing results for 
Search instead for 
Did you mean: 

Strange error using cypher with LOAD CSV

p_dipietro
Node Clone

Neo4j community edition 4.0.1 Running on Ubunto 20.04.2 LTS

The following is the starting part of a cypher query

LOAD CSV WITH HEADERS
FROM 'file:///xxx.csv'
as row
FIELDTERMINATOR ';'

WITH row, trim(row.Denominazione) as denominazione
WHERE row.Denominazione <> "" and row.Product <> ""

And these are the headers of the imported file:

Product Code;Product;Annata;Formato;Prezzo;Tipologia;Denominazione;Produttore;Regione

As you can see, in the headers there are two fields named Product and Denominazione, and in the query I try to use them.

The query returns the following error (but also a warning with a yellow triangle along the line) telling me:

The provided property key is not in the database
One of the property names in your query is not available in the database, make sure you didn't misspell it or that the label is available when you run this statement in your application (the missing property name is: Denominazione)
WITH row, trim(row.Denominazione) as denominazione
^
The provided property key is not in the database
One of the property names in your query is not available in the database, make sure you didn't misspell it or that the label is available when you run this statement in your application (the missing property name is: Product)
WHERE row.Denominazione <> "" and row.Product <> ""

The two fields are not into the database, because they are into the file to be imported!!!!

Have you got any suggestions?

Thank you

1 ACCEPTED SOLUTION

p_dipietro
Node Clone

Product Code;Product;Annata;Formato;Prezzo;Tipologia;Denominazione;Produttore;Regione;URL Immagine;URL Prodotto;Vitigno;Availability;Categories;Shipping Cost

12;Baladin Isaac Blanche 75cl;;cl.75;880;Birra;;Baladin;;https://www.bernabei.it/media/catalog/product/l/_/l_12.png;http://www.bernabei.it/baladin-isaac-blanche-75-cl;;in stock;Birre;490

The problem has been solved moving to neo4j 4.3.2 😉

View solution in original post

6 REPLIES 6

Joel
Ninja
Ninja

could you run this query to show the headers and let us know what you see? Just to double check,

LOAD CSV WITH HEADERS
FROM 'file:///xxx.csv'
as row
FIELDTERMINATOR ';'
WITH row LIMIT 1 
RETURN keys(row);

Reference: How do I view the column headers of a CSV file with LOAD CSV - Knowledge Base

Note: it is extremely rare but technically speaking there could be a non-printable character in the header line in the csv file

p_dipietro
Node Clone

Here is the result:

keys(row)
1 ["Availability", "Annata", "Regione", "Categories", "Product Code", "Product", "Shipping Cost", "Formato", "Tipologia", "URL Prodotto", "Prezzo", "Vitigno", "Produttore", "Denominazione", "URL Immagine"]

As you can see, it looks clean!

omerule
Graph Buddy

You could try backticks (`) with column name contain spaces " " something like:
Row.`URL Immagine`

Yours Kindly Omer

p_dipietro
Node Clone

yes, I used backtick. The problem is with the row.Denominazione and row.Product that don't need backtick.

Please post one row of data (with headers) from your .csv file. Looks like there is some mismatch somewhere.

p_dipietro
Node Clone

Product Code;Product;Annata;Formato;Prezzo;Tipologia;Denominazione;Produttore;Regione;URL Immagine;URL Prodotto;Vitigno;Availability;Categories;Shipping Cost

12;Baladin Isaac Blanche 75cl;;cl.75;880;Birra;;Baladin;;https://www.bernabei.it/media/catalog/product/l/_/l_12.png;http://www.bernabei.it/baladin-isaac-blanche-75-cl;;in stock;Birre;490

The problem has been solved moving to neo4j 4.3.2 😉