I'm trying to build a Dataflow pipeline, that triggers on a JSON file upload to Google Cloud Storage and writes it to Cloud Datastore.
According to the Dataflow template json file must have each line in Datastore data object format, defined here.
This is how my json file looks like which I'm trying to adapt to Datastore data object:
{
"userId": "u-skjbdw34jh3gx",
"rowRanks:": [
{
"originalTrigger": "recent",
"programmedRowPos": "VR1",
"reoderedRowPos": 0
},
{
"originalTrigger": "discovery",
"programmedRowPos": "VR1",
"reoderedRowPos": 1
}
]
}
Following is how far I've reached trying to adapt it to the above linked data object.
{
"key": {
"partitionId": {
"projectId": "gcp-project-id",
"namespaceId": "spring-demo"
},
"path":
{
"kind": "demo",
"name": "userId"
}
},
"properties": {
"userId": {
"stringValue": "01348c2f-9a20-4ad2-b95d-b3e29f6fc2d1"
}
}
}
Following is the error I'm getting in Dataflow when it's trying to write to Datastore:
com.google.protobuf.InvalidProtocolBufferException: java.io.EOFException: End of input at line 1 column 2 path $.
at com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1195)
at com.google.protobuf.util.JsonFormat$Parser.merge(JsonFormat.java:370)
at com.google.cloud.teleport.templates.common.DatastoreConverters$EntityJsonParser.merge(DatastoreConverters.java:497)
at com.google.cloud.teleport.templates.common.DatastoreConverters$JsonToEntity.processElement(DatastoreConverters.java:351)