Kamlesh Kumar
Kamlesh Kumar

Reputation: 293

Alternative to loading CSV files in Apache-age without acessing the local-path

I am implementing the functionality to upload CSV files on the Apache-age browser to generate graphs. However, the query for generating nodes or edges from CSV files requires the local path to the CSV files. Web browsers do not provide access to the local file system path for security reasons.

load_labels_from_file('<graph name>', 
                      '<label name>',
                      '<file path>', 
                      false)

Is there an alternative way to execute this query in Apache-age without the need to access the local file path, or another approach in JavaScript to achieve this objective?

Upvotes: 0

Views: 80

Answers (1)

Kamlesh Kumar
Kamlesh Kumar

Reputation: 293

After research, I found that the core of Apache-age allows us to load the CSV files by using only one method which is this query:

load_labels_from_file('<graph name>', 
                      '<label name>',
                      '<file path>', 
                      false)

Where we have to provide a path to the path of the local file.

So to solve this problem, I first stored the files on the node server by creating an endpoint there. So when the user uploads any CSV file these files are uploaded to the node server and that endpoint returns the path to that copy of the file on the server, which can be used in the above query to load CSV contents into the AGE database.

Upvotes: 0

Related Questions