【问题标题】:Json exception on dataflow job数据流作业上的 Json 异常
【发布时间】:2021-03-25 07:23:35
【问题描述】:

我正在尝试使用 Dataflow 作业将数据从 json 文件加载到 Datastore,但出现错误

来自工作人员的错误消息: com.google.protobuf.InvalidProtocolBufferException: com.google.gson.stream.MalformedJsonException:意外的值 第 1 行第 2 列路径 $ com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1347) com.google.protobuf.util.JsonFormat$Parser.merge(JsonFormat.java:477) com.google.cloud.teleport.templates.common.DatastoreConverters$EntityJsonParser.merge(DatastoreConverters.java:497) com.google.cloud.teleport.templates.common.DatastoreConverters$JsonToEntity.processElement(DatastoreConverters.java

看起来错误是由于 json 格式错误,但我的 json 如下所示,并通过 jsonlint 验证

[{
    "name1": "11",
    "name2": "haha"
}, {
    "name3": "value"
}]

有没有人分享一下这里出了什么问题。 PS我在数据流上使用模板Datastore to Text Files on Cloud Storage

【问题讨论】:

    标签: google-cloud-platform google-cloud-dataflow


    【解决方案1】:

    此模板要求输入为 json 格式的数据存储实体,而不仅仅是任何 json 对象,如此处所述:https://cloud.google.com/dataflow/docs/guides/templates/provided-batch#cloud-storage-text-to-datastore

    您需要遵守的格式在这里:https://cloud.google.com/datastore/docs/reference/data/rest/v1/Entity

    【讨论】:

      猜你喜欢
      • 2018-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-01
      • 2021-11-12
      • 2012-01-20
      • 1970-01-01
      相关资源
      最近更新 更多