Is it possible to add a new field to an existing field of RECORD type in bigquery from UI?

前端 未结 1 844
梦如初夏
梦如初夏 2021-02-08 04:40

Is it possible to add a new field to an existing field of RECORD type in bigquery? So for example if my current schema is :

{u\'fields\': [{u\'mode\': u\'NULLABL         


        
相关标签:
1条回答
  • 2021-02-08 05:42

    This can be done totally from within UI using respective API Explorers

    First, you need to get schema of your table. You can do this using Tables.get API Explorer. Make sure you select/check schema in fields box (better to leave the rest unchecked). Click Authorize and Execute. When done - Copy response text - it will look somehow like below

    {
     "schema": {
      "fields": [
       {
        "name": "id",
        "type": "STRING",
        "mode": "NULLABLE"
       },
    
    ... 
    
       {
        "name": "comment",
        "type": "STRING",
        "mode": "NULLABLE"
       }
      ]
     }
    }
    

    Then, use Tables.patch API Explorer
    Add needed fields(s) into previously retrieved schema and paste it as is into Patch Body box (chose freeform editor in the right-top corner of this box and just replace whatever inside with your schema's text). Again click Authorize and Execute

    You done now.
    Note that no matter where you put your new field within record - it will be added to the end of this record fields

    Btw, alternatively, you can use standalone Explorers
    Services > BigQuery API v2

    The ones that we used here are bigquery.jobs.get and bigquery.tables.patch

    0 讨论(0)
提交回复
热议问题