Created
February 21, 2020 02:54
-
-
Save Ramko9999/75f858a9358de0b5655fa351ee10cead to your computer and use it in GitHub Desktop.
WriteBacth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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