Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-04-2022 11:50 PM
Team,
I am trying to load the data from csv. I just want to right now list the non matching records.
Could there be a simple query?
Query below will give matching ones.
< LOAD CSV WITH HEADERS FROM "file:///mydetails.csv" AS records FIELDTERMINATOR ',' WITH records WHERE not records.PersonId IS NULL match (p:Person{Id:records.PersonId)}) return p.Id, records.PersonId limit 10000 />
thanks,
Kc
02-05-2022 12:15 AM
Below Query will give the non matching but is it ok or we have a different way?
<
LOAD CSV WITH HEADERS FROM "file:///mydetails.csv" AS records FIELDTERMINATOR ',' WITH records WHERE not records.PersonId IS NULL optional match (p:Person{Id:records.PersonId)}) with records.PersonId as csvPersonId , p.Id as personNeoId, count(records) as csvcount, count(p) as count
with csvPersonId where count = 0
return csvPersonId
/>
02-05-2022 10:59 AM
but is the goal then if the record exists in neo4j then update the record otherwise create the record?
if so see MERGE - Neo4j Cypher Manual and subsequent functionality described on the page
02-08-2022 04:28 AM
Yes, with merge we can create the missing . using on match and on create with merge.
But right now goal is just to compare the two, we are trying to find out missing records so.
All the sessions of the conference are now available online