I am using neo4j admin import command to import data from CSVs. But for array type, I am unable to set a value to store an empty array on the node.
For example, let's say I have a CSV with header
Thank you for responding.
Yes, I know about the workaround with the post processing query, but imagine an update query which goes through all the nodes and fixes them like this.
It's a very expensive operation and I am not sure if it will even work. There could be relations involded so even if I want to do it with apoc iterate with parallel: true, there is no guarentee it would work.
Yea, post processing could be "too heavy". But option 1 is not always too messy. It is usually just a question about coalesce(n.field2, []). Many times, I think dealing with absence of value in your queries, actually makes the queries "better". Storing null/empty could be considered waste.
But I have a thread ongoing with some other folks. Will keep you posted.
Thank you.
I understand that option 1 is not bad and if I was working on the application side, this is how I would fix it as well.
But we are trying to achieve a kind of in-place database migration without having to go through the communication overhead mess of application teams to adjust to our back-end change.
Also, since this is open source (I think), I would be happy to contribute to the fix/enhancement, although I will need some pointers on the issue I opened to know where to start.
And at some places we have a genuine need to differentiate between the two, for example:
Based on your last post, it sounds like you need to be able to import both null and empty list. How would you represent null vs empty list in your csv?
Yes I do need to differentiate between both, and how we push them depends on the API.
We can have a special identifier for empty array, for example [] could mean empty array instead of null. Right now [] is treated as an element and stores an array like ["[]"] in the database, and as we know neo doesn't support nested arrays so it kind of doesn't make sense.
It's a matter of preference how you would like to design the API.