Apache AGE- How to read a CSV File

269 Views Asked by At

I am using apache age and I have a CSV file with a bunch of data in it. I want to populate my graph using the information in the csv file, so can anyone help me with this, and also tell me if I have to preprocess my CSV file so that it is readable by the function which is going to be called by apache age.

3

There are 3 best solutions below

0
On BEST ANSWER

Yes, you can load data from CSV files into Postrgres using Apache AGE. The docs detail the steps necessary here: https://age.apache.org/age-manual/master/intro/agload.html

It is likely that you will need to preprocess your files so that the columns and headings are in the correct format.

0
On

Function load_labels_from_file is used to load vertices from the CSV files. Sample format is showing below:

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

As well as if we want to exclude the id field, then we need to add fourth parameter as false which such as: *** Use this when there is no id field in the file***

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

Again, Function load_edges_from_file can be used to load properties from the CSV file. Please see the file structure in the following.

Note: make sure that ids in the edge file are identical to ones that are in vertices files.

load_edges_from_file('<graph name>','<label name>','<file path>');

You can check this tutorial from official page(age).

0
On

You can populate a graph using the information in the CSV file. According to the documentation, there are two steps for the loading of graph:

  1. loading of vertices and
  2. loading of edges

'load_labels_from_file' is used to load vertices from the CSV files and 'load_edges_from_file' can be used to load properties from the CSV files.

You can find detailed information about it in this documentation: https://age.apache.org/age-manual/master/intro/agload.html