【发布时间】:2014-09-03 09:48:17
【问题描述】:
我们将不胜感激。
我有几个不同的 JSON 文档需要插入 BigQuery。现在为了避免手动生成模式,我使用了可用的在线 Json 模式生成工具的帮助。但是 BigQuery 加载数据向导不接受它们生成的架构。 例如:对于这样的 Json 数据:
{"_id":100,"actor":"KK","message":"CCD is good in Pune",
"comment":[{"actor":"Subho","message":"CCD is not as good in Kolkata."},
{"actor":"bisu","message":"CCD is costly too in Kolkata"}]
}
在线工具生成的schema是:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Generated from c:jsonccd.json with shasum a003286a350a6889b152
b3e33afc5458f3771e9c",
"type": "object",
"required": [
"_id",
"actor",
"message",
"comment"
],
"properties": {
"_id": {
"type": "integer"
},
"actor": {
"type": "string"
},
"message": {
"type": "string"
},
"comment": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "object",
"required": [
"actor",
"message"
],
"properties": {
"actor": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
但是当我在加载数据向导中将它放入 BigQuery 时,它会因错误而失败。
如何缓解这种情况?
谢谢。
【问题讨论】:
-
这并没有查看所有 BigQuery 架构,它是其他一些架构,您会感到困惑。你用的是什么生成器?
-
@Pentium 10 - 你可能没有仔细阅读我的问题。我在这里打印的模式是从在线 Json 模式生成器生成的。这是有效的。但 BigQuery 不接受这种格式。现在这里有根据 BigQuery 可接受的格式生成 Schema 的任何工具或实用程序吗?
-
无效格式错误。无法解析架构。所以它甚至没有创建表。
-
该工具会为您生成一些 Json Schema,但它不是 BQ 识别的格式。阅读 BQ 文档如何在 BQ 中定义表结构。目前还没有生成器可以执行这些操作。
标签: json google-bigquery