Updating a BigQuery Schema With Nested Fields/Records

Have the producers changed the message again? Here’s how you can update your BQ schema:

# Set GCP_PROJECT and BQ_TABLE to the appropriate values
# and make sure you are authenticated.
export GCP_PROJECT=MyGcpProject
# https://cloud.google.com/bigquery/docs/reference/bq-cli-reference#resource_specification
export BQ_TABLE=myProject:myDataset.myTable

gcloud config set project ${GCP_PROJECT}

bq show \
--schema \
--format=prettyjson \
${BQ_TABLE} > schema.json

# Replace vi with your fav :-)
vi schema.json

bq update ${BQ_TABLE} schema.json