Neo4j apoc.conf

Hi everyone,

I'm struggling a lot trying to LOAD csv file on a daily schedule...
I've created a file with the script like in neo4j browser ( :auto load csv from ...)
then I tried to execute cypher-shell and it doesn't work - "unknown command :auto".
so, after reading, i tried "apoc.periodic.iterate('call apoc.load.csv("file....)) and also doesn't work - also tried in browser... it says:
"Failed to invoke procedure 'apoc.periodic.iterate': Caused by: java.lang.RuntimeExcpetion: import from files not enabled, please set apoc.import.fileenabled=true in your apoc.conf."

I created a file "apoc.conf" and put it in the conf folder , near neo4j.conf
in the conf file i wrote the line: "apoc.import.file.enabled=true", restart the service and doesn't help.
I don't know what to do else.
Any ideas ?
Thanks

@yanivts1

What version of Neo4j? I'd like to see if i can reproduce etc

Can you provide the cypher you are trying to execution using cypher-shell?

I just tried the following in cypher-shell and it worked.

You would need ":auto" when executing in Neo4j Browser, but it does not look necessary when executing in cypher-shell.

1 Like

It's working!
Now i need to schedule it...
Thanks

1 Like

Hi,

When i try to load 2 million rows , the CPU goes up to 100% and everything crushes.
Any ideas?
From browser it didn't happen.

BTW, I'm using MERGE

CALL {
LOAD CSV...
MERGE (p:Person {idNumber: row.idNumber})
ON CREATE SET
p.update = datetime(),
p.name = row.name
....
}
IN TRANASCTIONS OF 500 ROWS

Thanks

If you are now using merge, do you have an index on Person(idNumber)?

yes, i have index.
Maybe the server resources is not enough?
I have 16GB RAM
Also, in the conf file i set the memory heap to 16GB and other memory things to high

Also, 500 rows is probably too low. Investigate 10,000 and multiples of to see if performance is better

Hi,

The cypher-shell worked for me and i made some progress...
Now, i want to load the data and handle errors with problematic rows.
I found some queries to do this, but again, have errors.
I'm trying in browser, not cypher-shell
so, i tried to simplify the query (without error handling) and came up with a shorter query ' just to check if it works, and it doesn't. still fail to invoke "apoc.periodic.iterate...", complaining on apoc.conf...
I'm using Neo4j 5.16, and also apoc plugins: core and extended 5.16. Also tried in Neo4j 5.20.
Here is the query:
CALL apoc.periodic.iterate(
** "CALL apoc.load.csv('file:///TEST/Persons-Full.csv',**
** {header:true}) YIELD map AS row",**
** "MERGE (s:Person {idNumber: row.idNumber})",**
{batchSize:10000, parallel:false} )

The Error:
Failed to invoke procedure apoc.periodic.iterate: Caused by: java.lang.RuntimeException: Import from files not enabled, please set apoc.import.file.enabled=true in your apoc.conf

I created a file: apoc.conf
and put 1 line:
apoc.import.file.enabled=true

What else can i try?

Thanks

I just verified this works. Assuming you placed the file in the database's "conf" folder, did you restart the server after adding the file?

Thanks,

Sure i restarted the server after putting the file in the config folder.
Anyway, it started working somehow.

1 Like