简体   繁体   English

Big Query中的JSON的架构应该是什么?

[英]What should be the schema for the JSON in Big Query?

I have the following JSON and i have to import it to Big Query. 我有以下JSON,我必须将其导入到Big Query。 What schema should i specify for the below JSON? 我应该为以下JSON指定哪种架构? What should be the field names of the table? 该表的字段名称应该是什么? I am using BigQuery WebUI. 我正在使用BigQuery WebUI。

     {
      "users": {
        "userid1mohan": {
          "password": "123456",
          "username": "mohan"
        },
        "userid2kutubuddin": {
          "password": "234567",
          "username": "kutubuddin"
        },
        "userid3pankaj": {
          "password": "345678",
          "username": "pankaj"
        },
        "userid4vivek": {
          "password": "456789",
          "username": "vivek"
        }
      }
    }

Please note that BigQuery will easily ingest CSVs and newline delimited JSONs, but not a plain JSON file like the one provided in the question. 请注意,BigQuery会轻松提取CSV和换行符分隔的JSON,但不会像问题中提供的那样提取纯JSON文件。

Find a specification on the newline delimited JSON format here: http://dataprotocols.org/ndjson/ 在此处找到以换行符分隔的JSON格式的规范: http : //dataprotocols.org/ndjson/

For a use case like this one, the nljson would need to look like: 对于这样的用例,nljson应该看起来像:

{"username":"kutubuddin","password":"456789"}
{"username":"pankaj","password":"312231"}
{"username":"vivek","password":"123h1"}

So you'll need to transform the json object you have into multiple json objects, one in each line, before ingesting it into BigQuery. 因此,您需要先将拥有的json对象转换为多个json对象(每行一个),然后再将其提取到BigQuery中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM