Skip to content

Instantly share code, notes, and snippets.

View itroulli's full-sized avatar

Ilias Troullinos itroulli

  • Trakken Web Services GmbH
  • Barcelona, Spain
View GitHub Profile
@itroulli
itroulli / getBQschema.sh
Created May 6, 2021 11:51
Use this script to get the BQ table schema in a format that can be used to create a new BQ table.
#!/bin/bash
if [ -z $1 ]; then
echo "Provide a BigQuery table spec, in the format of: <PROJECT_ID>:<DATASET_ID>.<TABLE_ID>"
exit 1
fi
if $(echo "" | jq .); then
bq show --format=prettyjson p$1 | jq '.schema.fields'