Sno*_*key 4 json google-bigquery
我对我们正在做的项目有疑问......
我试图将此JSON提取到Google Big Query,但无法从JSON输入中获取JSON投票对象字段.我尝试了架构中的"记录"和"字符串"类型.
{
"votes": {
"funny": 10,
"useful": 10,
"cool": 10
},
"user_id": "OlMjqqzWZUv2-62CSqKq_A",
"review_id": "LMy8UOKOeh0b9qrz-s1fQA",
"stars": 4,
"date": "2008-07-02",
"text": "This is what this 4-star bar is all about.",
"type": "review",
"business_id": "81IjU5L-t-QQwsE38C63hQ"
}
Run Code Online (Sandbox Code Playgroud)
此外,我无法从类别和邻居JSON数组的JSON下面填充表格?我的架构应该用于这些输入?在这种情况下,文档并没有太多帮助,或者我可能没有找到正确的地方..
{
"business_id": "Iu-oeVzv8ZgP18NIB0UMqg",
"full_address": "3320 S Hill St\nSouth East LA\nLos Angeles, CA 90007",
"schools": [
"University of Southern California"
],
"open": true,
"categories": [
"Medical Centers",
"Health and Medical"
],
"neighborhoods": [
"South East LA"
]
}
Run Code Online (Sandbox Code Playgroud)
我能够获得常规字段,但这就是它...任何帮助表示赞赏!
因为business你似乎希望学校成为一个重复的领域.您的架构应该是:
"schema": {
"fields": [
{
"name": "business_id",
"type": "string"
}.
{
"name": "full_address",
"type": "string"
},
{
"name": "schools",
"type": "string",
"mode": "repeated"
},
{
"name": "open",
"type": "boolean"
}
]
}
Run Code Online (Sandbox Code Playgroud)
因为votes它似乎你想要记录.您的架构应该是:
"schema": {
"fields": [
{
"name": "name",
"type": "string"
}.
{
"name": "votes",
"type": "record",
"fields": [
{
"name": "funny",
"type": "integer",
},
{
"name": "useful",
"type": "integer"
},
{
"name": "cool",
"type": "integer"
}
]
},
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7489 次 |
| 最近记录: |