问题
I'm trying to display one column of a .csv file in Neo4j. Here in the content of .csv file:
site,IP
ex1.com,10.10.10.10
ex2.com,11.0.0.0
I use this query:
LOAD CSV WITH HEADERS FROM 'file:///file.csv' AS row
WITH row[1] AS ip
RETURN ip
LIMIT 3
but I get this error:
Expected Long(1) to be a org.neo4j.values.storable.TextValue, but it was a org.neo4j.values.storable.LongValue
What's wrong?
回答1:
Since you specified the WITH HEADERS
option, you should access the file's data fields using the appropriate header names instead of using indexing (e.g., row[1]
). Indexing would just give you strange results or errors because the software would try to treat the header row like any other row.
For example, this query should work just fine:
LOAD CSV WITH HEADERS FROM 'file:///file.csv' AS row
RETURN row.IP AS ip
LIMIT 3
来源:https://stackoverflow.com/questions/60129695/facing-an-error-while-trying-to-get-a-csv-column