Reputation: 556
I'm trying to import data from a cvs file and am getting this error:
Node(36) with label
SupportInfo
must have the propertyname
I just finished doing a similar import to another node type which had the same 3 constraints. First I created a node like this:
CREATE (n:SupportInfo {id: 'b3542c32-b99d-4fff-b15e-05d5403030c5', name: 'test node', url: 'some url', pathToMedia: 'some path', remarks: 'Souds lagit', publishedDate: '2020-04-16'})
Then I create a unique and two not null consraints like this:
CREATE CONSTRAINT SupportInfo_id_unique FOR (n:SupportInfo) REQUIRE n.id IS UNIQUE
CREATE CONSTRAINT SupportInfo_id_notnull FOR (n:SupportInfo) REQUIRE n.id IS NOT NULL
CREATE CONSTRAINT SupportInfo_name_notnull FOR (n:SupportInfo) REQUIRE n.name IS NOT NULL
and this is the code to load the data:
LOAD CSV WITH HEADERS FROM 'file:///SupportInfo.csv' AS row
CREATE (n:SupportInfo)
SET n.id = row.id, n.name = row.name, n.url = row.url, n.pathToMedia = row.pathToMedia, n.remarks = row.remarks, n.publishedDate = row.publishedDate
And this is my data:
As you can see, every row has a value for the name property, yet I'm getting the error saying:
...must have the property
name
Seems like I did everything perfect. Any idea what went wrong and how to resolve this?
New info: I deleted the 2 "not null" constrains and was able to execute the query (command or what ever you call it) and I see that the nodes were created but no property values. how could this be?
Thanks.
Upvotes: 1
Views: 766
Reputation: 556
OK this is what happened:
The first import that worked, I started with data in an Excel file, then saved as a csv.
The second import that failed, I started with a new csv file and added data to it. Evidently the data was not formatted correctly internally even through it looked the same in the grid,
I attempted to do the second import again, but this time I started with an Excel file, added the data, then saved as a csv file. and Presto... the import succeded.
In all three cases I added the data via a copy/paste from SQL Server by running a select statement in a script and coping the ouptput with column headers. The point being made here is the save data went in the same way in both Excel and csv, but the conversion from Excel to csv must have formatted the data correctlyh behind the scenes.
I hope this helps someone else.
Upvotes: 1