1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-4.git synced 2024-11-26 01:44:22 +00:00
bda-4-steffo/scripts/import-cratesio/7-crate_owners.cypher
2023-03-05 21:49:24 +01:00

11 lines
No EOL
448 B
Text

MATCH (:User)-[owns:OWNS]->(:Crate)
DELETE owns;
LOAD CSV WITH HEADERS FROM "file:///crate_owners.csv" AS line FIELDTERMINATOR ","
MATCH (crate:Crate { id: toInteger(line.crate_id) })
MATCH (owner:User { id: toInteger(line.owner_id) })
CREATE (owner)-[ownership:OWNS {
created_at: apoc.date.parse(line.created_at, "ms", "yyyy-MM-dd HH:mm:ss"),
created_by: toInteger(line.created_by),
owner_kind: toInteger(line.owner_kind)
}]->(crate);