Reputation: 924
I understand we can export table schema info in JSON format by 'bq show' command in GCP, but don't know how to export to yaml file.
Is there any way to convert schema info to yaml file automatically? Our table's structure is a bit complicated and target tables are so much.
Upvotes: 1
Views: 614
Reputation: 235
You could use the tool yq for this task.
Example:
bq show --schema --format=prettyjson [PROJECT_ID]:[DATASET].[TABLE] | yq -p json -o yaml
This command pipes the output of the bq
command to yq
which reads the json
-input and exports to yaml
.
Upvotes: 2