Data type on import


(Ishaan Madan) #1

For neo4j-admin import, if I have a header file that looks like this:

userid:ID,zipcode:int

Is there any way I can cast my userID as long? Perhaps in the relationship file? Something like this

:START_ID:long, :END_ID:long

The userIDs are rather lengthy strings so id like to cast them to longs to save space


(Michael Hunger) #2

You can use globally --id-type integer but that's for all ids.
Afaik it's not possible per type.

You could change it later, .e.g. with

call apoc.periodic.iterate("
MATCH (u:User) RETURN u
","
SET u.userid = toInteger(u.userid)
",{batchSize:10000,iterateList:true, parallel:true})