创建bigquery表模式时出现问题

时间:2015-03-16 11:03:02

标签: arrays json schema google-bigquery

使用Google BigQuery我需要手动创建一个表并加载json文件中包含的数据。我正在使用BigQuery UI,但无法定义数据的架构,下面给出了相同的示例。问题来自json数组,如下所示。

{"Author": "Pranesh Nageshwar", "headline": "Train trashes crashed car", "charactercount": 1027, "dateLive": "2014-01-14", "keywords": ["train crash", "freight train", "online reporting page", "side road", "blue mountains", "new south wales", "australia", "blaxland", "new south wales", "australia", "crime stoppers", "springwood police station", "train tracks"], "id": "1226801299367"}

1 个答案:

答案 0 :(得分:2)

BigQuery中的值数组表示为具有重复模式的字段。您想要的架构可能如下。如果您将其复制并粘贴到Web UI中的框中,我认为它会起作用。

[
  {
    "name": "author",
    "type": "string"
  },
  {
    "name": "headline",
    "type": "string"
  },
  {
    "name": "charactercount",
    "type": "integer"
  },
  {
    "name": "dateLive",
    "type": "string",
  },
  {
    "name": "keywords",
    "type": "string",
    "mode": "repeated"
  },
  {
    "name": "id",
    "type": "string"
  }
]