Running neo4j Community server 4.4.5 on Ubuntu 20.04
I have the following query:
LOAD CSV WITH HEADERS FROM 'file:///asset_statuses.csv' AS row FIELDTERMINATOR ';'
call {
WITH row
CREATE (asset_statuses:AssetStatus)
SET asset_statuses=row,
asset_statuses.uuid=apoc.create.uuid()
WITH asset_statuses,row
MATCH (asset:Asset { id: row.asset_id})
MERGE (asset)-[:HAS_STATUS]->(asset_statuses)
} IN TRANSACTIONS OF 1000 ROWS
RETURN row
I avoided PERIODIC COMMIT because it is discouraged and will be discontinued, but the query ì, which is (seems to be) exactly equal to the example, returns the following error:
Neo.DatabaseError.Statement.ExecutionFailed: A query with 'CALL { ... } IN TRANSACTIONS' can only be executed in an implicit transaction, but tried to execute in an explicit transaction.
How could this be done if not using the Neo4j browser? I'm using the .net driver and .net client packages, and I have seen that this behavior differs depending on how Neo4j is accessed, but I haven't found the answer. I have the same error. Anything would help. Thank you!
For anyone else who's pointed here by Google in the future, the solution is to add auto: in front of your query.
auto: LOAD CSV WITH HEADERS FROM 'file:///asset_statuses.csv' AS row FIELDTERMINATOR ';'
call {
WITH row
CREATE (asset_statuses:AssetStatus)
SET asset_statuses=row,
asset_statuses.uuid=apoc.create.uuid()
WITH asset_statuses,row
MATCH (asset:Asset { id: row.asset_id})
MERGE (asset)-[:HAS_STATUS]->(asset_statuses)
} IN TRANSACTIONS OF 1000 ROWS
RETURN row