Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-19-2020 04:46 PM
Hi all,
I have a newbie question. I am trying to import pipe-delimited data using the LOAD CSV function and am having an issue where the first column of my data does not appear to get loaded. The first column is an ID column with numbers and, whether I specify them to be string or int, they get ignored. Here are the commands I used to load the data:
create CONSTRAINT ON (person:PATIENT) ASSERT person.patient_id IS UNIQUE
create CONSTRAINT ON (provider:PROVIDER) ASSERT provider.PROVIDER_KEY IS UNIQUE
LOAD CSV WITH HEADERS FROM "file:///neo4j_patient.txt" as csvLine FIELDTERMINATOR '|' CREATE (Patient:PATIENT {patient_id:csvLine.patient_id, patient_name:csvLine.PATIENT_NAME, DOB:csvLine.DOB, Gender:csvLine.GENDER, Region:csvLine.REGION})
LOAD CSV WITH HEADERS FROM "file:///neo4j_provider.txt" as csvLine FIELDTERMINATOR '|' CREATE (PROVIDER:PROVIDER {provider_id:toInteger(csvLine.provider_key), provider_name:csvLine.PROVIDER_NAME, specialty:csvLine.Specialty, provider_type:csvLine.PROVIDER_TYPE, Region:csvLine.REGION})
There are no errors when I load the data but when I do a MATCH for the patient or provider IDs I get nulls returned. The IDs are not properties of the Patient and Provider nodes.
I am using Neo4j 3.5.14.
Thanks for your help,
Neil
04-19-2020 05:37 PM
Few questions -
If #2/3 do the trick, I don't need #1 🙂 Happy to help further.
LP
04-21-2020 05:54 PM
Hi Llewellyn,
Sorry I can't share the data but I just loaded another file with a similar structure and it looks fine. I will try and delete the patient and provider data and retry.
Thanks for your reply.
Regards,
Neil
04-19-2020 10:26 PM
Apart from suggestion from @nlennertz. Please recheck the Node property you have created while Node Creation and you have used in the Match statement are same.
04-21-2020 05:56 PM
Hi Vivek,
I did recheck and they were the same. I just loaded another file with a similar structure and it looks fine. I will try and delete the patient and provider data and retry.
Thanks for your reply.
Regards,
Neil
04-21-2020 09:17 PM
The file extension is .txt in. your code. Change the file extension to .csv:
file:///neo4j_patient.csv
05-05-2020 10:37 PM
Thanks for the suggestion. I found my issue was with my SQL background and not being strict with names. A field called PATIENT_KEY in my data file would not be imported as a property if I called it Patient_Key in my load CSV statement.
All the sessions of the conference are now available online