1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-4.git synced 2024-11-23 08:24:23 +00:00
bda-4-steffo/scripts/import-cratesio/6-users.cypher
2023-03-05 21:49:24 +01:00

23 lines
594 B
Text

CREATE RANGE INDEX index_user_id IF NOT EXISTS
FOR (user:User)
ON (user.id);
CREATE RANGE INDEX index_user_ghid IF NOT EXISTS
FOR (user:User)
ON (user.gh_id);
CREATE TEXT INDEX index_user_name IF NOT EXISTS
FOR (user:User)
ON (user.name);
CREATE TEXT INDEX index_user_fullname IF NOT EXISTS
FOR (user:User)
ON (user.full_name);
LOAD CSV WITH HEADERS FROM "file:///users.csv" AS line FIELDTERMINATOR ","
MERGE (user:User { id: toInteger(line.id) })
SET
user.avatar = line.gh_avatar,
user.gh_id = toInteger(line.gh_id),
user.name = line.gh_login,
user.full_name = line.name;