Help Center/ Graph Engine Service/ devg/ Using the Management Plane SDK/ Incrementally Importing Data to a Graph
Updated on 2022-11-14 GMT+08:00

Incrementally Importing Data to a Graph

You can call a GES API to incrementally import data to a graph. The sample code is as follows:
public static void incrementImport(GraphClient graphClient) throws ApiException 
{
     ImportGraphReq importGraphReq = new ImportGraphReq();
     importGraphReq.setGraphName(graphName);
     importGraphReq.setEdgesetPath("/home/lh/movie/ranking_edge.csv");
     importGraphReq.setEdgesetFormat("csv");
     importGraphReq.setVertexsetPath("/home/lh/movie/movies_vertex.csv");
     importGraphReq.setVertexsetFormat("csv_prop");
     ObsParameters obsParameters = new ObsParameters();
     obsParameters.setAccessKey("EW39NCDEXJ4E1JTN2PCP");
     obsParameters.setSecretKey("rhsS0TP89IdNnDe6dug1iraEbQUeNZlbJ3QGgW5D");
     obsParameters.setRegion("southchina");
     importGraphReq.setObsParameters(obsParameters);
     // Import data to graphs.
     AsyncAPIResp res = graphClient.incrementImport(importGraphReq);
     // Obtain the JobId.
     String jobId = res.getJobId();
     ImportGraphJobReq req = new ImportGraphJobReq();
     req.setJobId(jobId);
     //Query the import result based on the JobId.
     System.out.println(graphClient.queryJobStatus(req));
}