Accessing to csv files in GDrive from Neo4j Aura

You can easily access to csv files saved in storage from a Neo4j Desktop installation, by issuing a command like the following:

LOAD CSV WITH HEADERS FROM "file:///path/to/the/actual/file.csv"
MERGE ...

but how do you manage to do this with a hosted Neo4j Aura instance?

Neo4j Aura mainly allows you to import files in two manners:

The first option gives us an easy way with a GUI to import the data, but requires us to have a data model prepared in json. If we would like to first load the csv file, then manually issue the MERGE commands afterwards, we can choose the second option.

  1. First of all, load the file to Google Drive.
  2. Then right click over the uploaded file and select “Get shareable link”.
  3. In the dialog box, under the “General access” section, click on “Restricted” and choose “Anyone with the link” from the dropdown menu.
  4. Click on “Copy link”, paste it in a textbox. You should get an address such as the following: https://drive.google.com/file/d/gsbhokX66koMG7dMRtHQsuZrL6m7APbpT/view?usp=sharing. Select and copy the file id, after the /d/ and before the /view.
  5. Replace the file id in the following link: https://drive.google.com/uc?export=download&id=FILE_ID. This will be the link of the file that you will be using in Neo4j Aura.

Now you can issue the command in the Neo4j Aura Console as you would do in the Desktop instance, just by replacing the filename with the address that you got earlier:

LOAD CSV WITH HEADERS FROM "https://drive.google.com/uc?export=download&id=FILE_ID"
MERGE ...

2022-08-17-234958_1273x626_scrot.png

Et voilà!

 
0
Kudos
 
0
Kudos

Now read this

La Morte nel Cinema Giapponese

In questo periodo di quarantena forzata ho attraversato un po’ tutti gli stadi dello shock culturale. All'inizio una luna di miele durata letteralmente due settimane, quel periodo ancora un poco confuso in cui a tratti si tornava... Continue →