I created entities on datastore using the AppEngine SDK's python APIs and I'd like to retrieve them on Google Cloud Dataflow (Java). The entity's structure is something like this:
- entity
- embedded_entity (ndb.StructuredProperty(repeated=True))
- name
- name
- name
- name
- embedded_entity (ndb.StructuredProperty(repeated=True))
Retrieving would be something like this, but I know I am missing the step where I extract the data.
static class EmbeddedStringExtractor extends DoFn<Entity, String> {
@Override
public void processElement(ProcessContext c) {
Map<String, Value> main_entity_map = DatastoreHelper.getPropertyMap(c.element());
Entity embedded_entity = entity.get("embedded_entity").getEntityValue();
// missing step
Map<String, Value> embedded_entity_map = DatastoreHelper.getPropertyMap(embedded_entity);
String some_string = DatastoreHelper.getString(embedded_entity_map.get("name"));
}
}
How would I loop through all the repeated properties?