There is a huge nested (structured) table.
The need:
Create identical table with same schema and data on other project other region. Copying is not working as different regions.
Have been trying:
Export table to bucket (JSON as AVRO not allows edit schema once loading data), then extract old table schema and create a new table from bucket, providing schema. As typing schema manually is not possible because of structured table schema size and complexity.
Errors get:
Once creating a table, AVRO auto schema detect
is not recognizing some data types correctly, JSON fails with multiple errors.
The question:
How to export table schema, ideally in JSON? Once I run this in CLI:
bq show --format=prettyjson Project1:BQDataset.Table1 | jq '.schema.fields'
I get a massive (hundreds of rows) .json which is not feasible to copy at console by simple highlighting text in CLI result list. fragment of JSON result in CLI
Updated: The issue is solved and this initial approach is not correct.