Update Big Query Table Schema

前端 未结 2 624
后悔当初
后悔当初 2021-01-13 19:03

I have a table already in BQ that is populated with data. I want to rename the headings (update the schema) of the table. I\'m using command line tool

Presuming it\'

2条回答
  •  时光取名叫无心
    2021-01-13 19:24

    As Mosha says, renaming columns is not supported via API, but you could run a query that scans the whole table and overwrites it.

    bq query --nouse_legacy_sql \
     --destination_table p:d.table \
     --replace \
     'SELECT * EXCEPT(col1,col2), col1 AS newcol1, col2 AS newcol2 FROM `p.d.table`'
    

    Warning: This overwrites the table. But that's what you wanted anyways.

提交回复
热议问题