Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-15-2022 02:59 AM
Hello,
Question: for admin import, how can i use a different import folder than the default import folder, on versions later than 4.2.x? Preferrably relative folders rather than absolute folders
Background:
For my project, i have been using a pipeline that produce admin-importable CSV files.
i also have scripts for linux (bash) and windows (bat) that will run admin import from the NEO4j bin folder, and import the data in the import folder.
All this is copied to the machine running neo4j, either from S3 bucket, or git pull.
I currently do this primarily on linux servers, but also on Neo4j Desktop on Windows.
For this conversation, assume it is to c:\checkout on the windows
We now have a structure where my importable data is in c:\checkout\import\nodes\..... and the import script sits in c:\checkout\scripts
I have an env variable for where the binaries are located %NEO4J_BIN_PATH%
I have then been running the import command from c:\checkout:
%NEO4J_BIN_PATH%\neo4j-admin.bat import --nodes="import/nodes/......."
This is where i run into some problems with 4.3.0 and later (on Windows only).
(On Linux it seems to work fine with the relative paths, even on newer versions)
So back to the question:
Thanks and regards
06-15-2022 08:18 AM
Hey there @espen_solbu, I think I can lend some help!
If you are looking to import (using neo4j-admin import and/or LOAD CSV) there is a setting in your neo4j.conf you can comment out to allow imports from any directory in your filesystem (absolute path or relative path).
Within your neo4j.conf (towards the very top of the configuration file) you'll find the following setting:
# This setting constrains all `LOAD CSV` import files to be under the `import` directory. Remove or comment it out to
# allow files to be loaded from anywhere in the filesystem; this introduces possible security problems. See the
# `LOAD CSV` section of the manual for details.
#dbms.directories.import=import
All that is required for you to do to allow neo4j-admin import from any specified absolute or relative path within the neo4j-admin import command is to comment out "dbms.directories.import=import" as follows:
#dbms.directories.import=import
As stated in the the conf file, this is not recommended but doing this will enable you to import via desired relative/absolute path you'd like! Hope this helps!
Best,
Rob
06-15-2022 08:32 AM
Thanks,
Actually that was the first i tried... (However i was somewhat tentative as i saw it was set the same in my 4.2. instance that worked, as in my 4.4 instance that didn't work. Also since that hasn't been needed on my Linux or Mac instances.
I could not notice any difference with that setting commented out. I might have made a mistake though, I'll try the setting again just to confirm
Regards
Espen
All the sessions of the conference are now available online