I am using version 4.4.xx.
While loading a CSV file I am trying to write nodes conditionally in an apoc.when call.
It looks like this (sorry for some german names, but it should be readable)
LOAD CSV WITH HEADERS FROM "file:///path/to//my.csv" AS csvLine FIELDTERMINATOR ';' WITH
apoc.any.property(csvLine, 'Gebäude ID') AS buildingName,
apoc.convert.toInteger(apoc.any.property(csvLine, 'Jahr')) AS year,
apoc.convert.toInteger(apoc.any.property(csvLine, 'Monat')) AS month,
apoc.convert.toFloat(apoc.any.property(csvLine, 'Verbrauch')) AS val
OPTIONAL MATCH (b:Building {isPublic: true, name: buildingName}) WITH b, year, month, val
OPTIONAL MATCH (b)--(v:PeriodicVal {v: val})
WITH b, val, v, year, month
CALL apoc.when(b IS NOT NULL AND v IS NULL,
'MERGE (b)-[:ESTIMATED_BY_USER]->(v:PeriodVal {measuredObj: "districtHeating", year: $year, month: $month, v: val, createdAt: datetime.transaction("Europe/Berlin")}) RETURN v',
'RETURN {year: $year, month: $month, v: $val, msg: "not found or VAL present"}', {year: year, month: month, val: val}) YIELD value
RETURN
value;
But I am getting this error for executing this code from a cypher file, in which the code is wrapped in a
:begin
:commit
An error occurred while in an open transaction. The transaction will be rolled back and terminated. Error: Create node with labels '' on database 'neo4j' is not allowed for user 'myuser' with FULL overridden by READ. (Failure when processing file '/var/lib/neo4j/import/cnb/my.csv' on line 2.)
The problem might be related to some sort of duplication, but I really wanted to avoid this by using the conditions of matching already existing nodes.
I even do not understand the error message, what can I do better?