Reputation: 749
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 ?
com.google.cloud.datastore.Entity
.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
.
Upvotes: 3
Views: 543
Reputation: 6033
You have analyzed the situation well - Dataflow's DatastoreIO.v1()
works with com.google.datastore.v1.Entity
.
Upvotes: 1