Is there a way to export a BigQuery table's schema as JSON?

后端 未结 3 1179
走了就别回头了
走了就别回头了 2020-12-22 23:24

A BigQuery table has schema which can be viewed in the web UI, updated, or used to load data with the bq tool as a JSON file. However, I can\'t find a way to du

3条回答
  •  孤城傲影
    2020-12-23 00:22

    You can add the flag --schema[1] in order to avoid table data information.

    bq show --schema --format=prettyjson [PROJECT_ID]:[DATASET].[TABLE] > [SCHEMA_FILE]
    
    bq show --schema --format=prettyjson mydataset.mytable > /tmp/myschema.json
    

    [1] https://cloud.google.com/bigquery/docs/managing-table-schemas

提交回复
热议问题