Which of these is the correct / preferred way to create Datastore Entity:
// First, create a fake email for our fake user
final String email = "[email protected]";
// Now, create a 'key' for that user using the email
final Key userKey =
datastore.newKeyFactory().kind("user").newKey(email);
// Now create a entity using that key adn add some fields to it
final Entity newUser =
Entity
.builder(userKey)
.set("name", "Faker")
.set("email", email)
.build();
or like it's done in DatastoreWordCount example ?
- Entity from the first example is
com.google.cloud.datastore.Entity. - Entity from the second example is
com.google.datastore.v1.Entity.
I have code using com.google.cloud.datastore.Entity and I don't know how to store it Datastore as a part of Dataflow pipeline, since all code examples I found online suggest:
com.google.cloud.dataflow.sdk.io.datastore.DatastoreIO.v1().write()
but it's only working with com.google.datastore.v1.Entity.
I'm using com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:1.7.0.