Skip to content

Instantly share code, notes, and snippets.

@Ramko9999
Created February 21, 2020 02:54
Show Gist options
  • Save Ramko9999/75f858a9358de0b5655fa351ee10cead to your computer and use it in GitHub Desktop.
Save Ramko9999/75f858a9358de0b5655fa351ee10cead to your computer and use it in GitHub Desktop.
WriteBacth
/*
To create a write batch, simply call GraphClient.createWriteBatch()
*/
final writeBatch = client.createWriteBatch();
/*
We can essentially upsert as many vertices or edges as we want, and then when we are ready,
we can send all our upserted vertices and edges in one request.
The paramaters for upserting the Vertices and Edges will remain the same.
*/
List<Person> people = [.......]; //a huge list of people perhaps
for(int i = 0; i < 10000; i++){
Vertex person = Vertex("Person", people[i].id, people[i].serialize());
writeBatch.upsertVertex(person);
}
/*
Whenever we are ready, we simply have to commit our "batch"
*/
await writeBatch.commit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment